RE: XML Schema 1.1 suggestion - allow defining of namespaces for named elements or attributes

Lee asked me about this question privately, and I proposed a solution. Not 
sure whether it meets the need.  See attached:

------------------------------------------------------------------
Noah Mendelsohn                              Voice: 1-617-693-4036
IBM Corporation                                Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
------------------------------------------------------------------




----- Forwarded by Noah Mendelsohn/Cambridge/IBM on 06/18/2002 06:16 PM 
-----


Noah Mendelsohn
06/18/2002 05:41 PM


        To:     "Lee Humphries" <Lee_Humphries@softworks.com.au>
        cc: 
        Subject:        RE: XML Schema 1.1 suggestion - allow defining   of namespaces for 
namedelements or attributes


I'm still confused why there's a problem.  I think you're saying you have 
a wrapper elemen MessageBody which can have as its child a known set of 
elements, that happen to be in more than one namespace.  I don't want to 
do all the typing, so here's an outline.  I think you can fill in the 
details.

<schema targetNamespace="NS1">
        <element name="a" ...>
        <element name="b" ...>
        <element name="c" ...>
</schema>

<schema targetNamespace="NS2">
        <element name="x" ...>
        <element name="y" ...>
        <element name="z" ...>
</schema>

<schema targetNamespace="www.myenvelope.com" 
                xmlns:ns1="NS1"
                xmlns:ns2="NS2">
        <element name="messageBody">
                <choice>
                        <element ref="ns1:a"/>
                        <element ref="ns1:b"/>
                        <element ref="ns1:c"/>
                        <element ref="ns2:x"/>
                        <element ref="ns2:y"/>
                        <element ref="ns2:z"/>
                </choice>
        </element>
</schema>

Doesn't this do what you need?  It accepts exactly the 6 elements, three 
from each namespace.  You only use <any> when you don't know the element 
names in advance.  The namespace is part of the element name.  Hope this 
helps.


------------------------------------------------------------------
Noah Mendelsohn                              Voice: 1-617-693-4036
IBM Corporation                                Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
------------------------------------------------------------------







"Asir S Vedamuthu" <asirv@webmethods.com>
Sent by: xmlschema-dev-request@w3.org
06/18/2002 07:53 AM
Please respond to asirv

 
        To:     <xmlschema-dev@w3.org>
        cc:     "Lee Humphries" <Lee_Humphries@softworks.com.au>, (bcc: Noah 
Mendelsohn/Cambridge/IBM)
        Subject:        RE: XML Schema 1.1 suggestion - allow defining   of namespaces for named 
elements or attributes



Moving this to the schema dev list for discussion

Asir

-----Original Message-----
From: www-xml-schema-comments-request@w3.org
[mailto:www-xml-schema-comments-request@w3.org]On Behalf Of Asir S
Vedamuthu
Sent: Tuesday, June 18, 2002 7:38 AM
To: www-xml-schema-comments@w3.org
Cc: Lee Humphries
Subject: RE: XML Schema 1.1 suggestion - allow defining of namespaces
for named elements or attributes



Lee requested me to post this mail to comments list

-----Original Message-----
From: Lee Humphries [mailto:Lee_Humphries@softworks.com.au]
Sent: Sunday, June 16, 2002 6:56 PM
To: asirv@webmethods.com
Subject: RE: XML Schema 1.1 suggestion - allow defining of namespaces
for named elements or attributes


Hi Asir,

Sorry, obviously I didn't put in enough detail.

Here's a very simple example of what I'm looking to do (deliberately
sans namespace prefixes):
<Envelope xmlns="www.myenvelope.com">
                 <From>Me</From>
                 <To>You</To>
                 <MessageBody>
                                 <SomethingSpecific 
xmlns="www.mymessage.com">
                 </MessageBody>
</Envelope>

The thinking at the moment is that we'd define the contents of
<MessageBody> as xsd:any with a namespace="##other" for example.
What I'm dealing with though, is that I know in advance all the
different element names within <MessageBody> and I also know their
namespaces.  What I want to be able to do is to define both the element
name and the namespace, whereas at the moment I can only define one or
the other.
In other words I can have:
...
<xsd:element name="MessageBody">
                 <xsd:complexType>
                                 <xsd:choice>
                                                 <xsd:element 
name="SomethingSpecific"
type="SomethingSpecificType"/>
                                                 <xsd:element 
name="SomeError"
type="SomeErrorType"/>
                                 </xsd:choice>
                 </xsd:complexType>
</xsd:element>
...

or:

...
<xsd:element name="MessageBody">
                 <xsd:complexType>
                                 <xsd:sequence>
                                                 <xsd:any 
namespace="www.mymessage.com
www.myerror.com"/>
                                 </xsd:sequence>
                 </xsd:complexType>
</xsd:element>
...

But what I really want is:
...
<xsd:element name="MessageBody">
                 <xsd:complexType>
                                 <xsd:choice>
                                                 <xsd:element 
name="SomethingSpecific"
namespace="www.mymessage.com" type="SomethingSpecificType"/>
                                                 <xsd:element 
name="SomeError"
namespace="www.myerror.com" type="SomeErrorType"/>
                                 </xsd:choice>
                 </xsd:complexType>
</xsd:element>
...

Regards,
Lee Humphries
SOFTWORKS Australia
email: Lee_Humphries@softworks.com.au
phone: +61-7 3511 7000
Level 1, 33 Park Road, Milton, Queensland 4064, Australia

-----Original Message-----
From: Asir S Vedamuthu [mailto:asirv@webmethods.com]
Sent: Saturday, 15 June 2002 2:27 AM
To: Lee Humphries; W3C XML Schema Comments list
Subject: RE: XML Schema 1.1 suggestion - allow defining of namespaces
for named elements or attributes


Lee,

I do not understand your suggestion. May I request you to elaborate with
one
or two examples?

Asir

-----Original Message-----
From: www-xml-schema-comments-request@w3.org
[mailto:www-xml-schema-comments-request@w3.org]On Behalf Of Lee
Humphries (by way of "C. M. Sperberg-McQueen" <cmsmcq@acm.org>)
Sent: Friday, June 14, 2002 11:18 AM
To: W3C XML Schema Comments list
Subject: XML Schema 1.1 suggestion - allow defining of namespaces for
named elements or attributes






At the moment only the 'any' allows for its namespace to be defined.
This is a real pain in the neck when you can name the element (or
attribute) but you need to define it as existing in a different
namespace.
Adding the 'any' namespace declaration to 'element' and 'attribute'
would
go a long way to enabling full cross-namespace validation.

Lee Humphries
SOFTWORKS Australia
email: Lee_Humphries@softworks.com.au

Received on Tuesday, 18 June 2002 18:19:00 UTC