- From: <noah_mendelsohn@us.ibm.com>
- Date: Tue, 18 Jun 2002 23:25:16 -0400
- To: "Lee Humphries" <Lee_Humphries@softworks.com.au>
- Cc: asirv@webmethods.com, "Henry S. Thompson" <ht@cogsci.ed.ac.uk>, xmlschema-dev@w3.org
Well, schemas made a design decision that each schema document contributes
declarations for one namespace. This was done as a conscious tradeoff, as
namespaces are often used to group definitions and declarations that are
controlled by a given organization or group. We could have done
otherwise, but chose not to. Note this is a feature of the representation
of schemas in documents -- a different serialization might be different.
Anyway, a consequence of this is that you MUST use ref= to combine
constructs from multiple namespaces. No way around it. Local
declarations (which is what I think you mean when you say 'name' and
'type') are scoped to their containing element, and therefore in the same
namespace (I've oversimplified a bit, but the general sense of this
explanation is right.)
I suspect you're trying to avoid writing more than one schema document.
When you're validating more than one namespace, you can't. You can
almost surely do what you need to do as long as you write one schema
document per namespace, and use ref=.
------------------------------------------------------------------
Noah Mendelsohn Voice: 1-617-693-4036
IBM Corporation Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
------------------------------------------------------------------
"Lee Humphries" <Lee_Humphries@softworks.com.au>
06/18/2002 06:28 PM
To: <noah_mendelsohn@us.ibm.com>, <asirv@webmethods.com>
cc: <xmlschema-dev@w3.org>, "Henry S. Thompson" <ht@cogsci.ed.ac.uk>
Subject: RE: XML Schema 1.1 suggestion - allow defining of namespaces for
namedelements or attributes
Hi Noah & Asir,
The situation's different when you 'name' and 'type' the element rather
than 'ref' to an existing element. When you name and type the element
after importing the associated schema you lose the namespace as a
requirement of the newly defined element. My objective was to get a
specific 'named and typed' element to also be required to exist in a
differing namespace from its parent, without refing (if there's such a
word).
Regards, Lee
-----Original Message-----
From: noah_mendelsohn@us.ibm.com [mailto:noah_mendelsohn@us.ibm.com]
Sent: Wednesday, 19 June 2002 8:01 AM
To: asirv@webmethods.com
Cc: Lee Humphries; xmlschema-dev@w3.org
Subject: RE: XML Schema 1.1 suggestion - allow defining of namespaces
for namedelements 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 23:44:08 UTC