Lists Home |
Date Index |
Thanks, that is a very helpful link.
At 11:09 AM +0000 11/20/02, firstname.lastname@example.org wrote:
>This link may be of help
>From: Rex Brooks [mailto:email@example.com]
>Sent: 19 November 2002 19:47
>To: Priscilla Walmsley; 'Peter Bergström'; firstname.lastname@example.org
>Subject: RE: [xml-dev] Namespaces and XML Schema validation
>Is it possible to have a number of schemata that are extensions of a
>primary base schema within a single namespace? Or, do you have to
>create serial namespaces to accommodate such a multi-part modular
>language structure? Since that is exactly what we are doing with
>Human Markup, it would helpful. We are currently in the 30-day public
>comment period for our first spec so we are no where close to moving
>on to the secondary base schema.
>At 9:01 AM -0500 11/19/02, Priscilla Walmsley wrote:
>>Yes, you can only have one schema document per namespace, so you will
>>be required to have a.xsd, b.xsd, etc.
>>> PROBLEM 1
>>> Example document:
>>> <?xml version="1.0">
>>> <a1 xsi:noNamespaceSchemaLocation="a.xsd"
>>> <b:b1>This is element B1 from namespace B</b:b1>
>>> <a2>This is the second element from schema a</a2>
>>> <c:c1>This element is from namespace c</c:c1>
>>a.xsd would look something like this:
>><xsd:import namespace="http:\\example.org\b\" schemaLocation="b.xsd"/>
>><xsd:import namespace="http:\\example.org\c\" schemaLocation="c.xsd"/>
>><xsd:element name="a1" type="a1Type"/>
>> <xsd:element ref="b:b1"/>
>> <xsd:element name="a2" type="xsd:string"/>
>> <xsd:element ref="c:c1"/>
>>and b.xsd and c.xsd would declare the b1 and c1 elements, globally.
>>> PROBLEM 2
>>> Can I nest the namespaces in such an XML document, so that elements
>>> from one namespace contains elements from other namespaces, and
>>> still validate my XML
>>> document against one or several XML Schemas?
>>Yes, in this case you could have a.xsd import the b namespace, and
>>b.xsd import the c namespace.
>>> PROBLEM 3
>>> Can elements from one namespace occur several times in a hierarchy
>>> where elements from other namespaces occur as fathers, i.e. true
>>> nesting, and
>>> still validate my XML document against one or several XML
>>> Schemas? And how
>>> would the XML Schemas that defines those namespaces look like?
>>Yes, in that case a.xsd could import the b namespace, and b.xsd could
>>import the a namespace. Same thing with b and c. (there is no rule
>>that says "circular imports" are not allowed; in fact, they are
>>> PROBLEM 4
>>> Can I, using the example from my problem 3, enforce (through
>>> that instances are created with exactly those elements, occuring
>>> just one time each, with one single XML Schema?
>>I assume you mean one single schema _document_ (since an XML Schema can
>>be made up of more than one document, as we have seen above). No, you
>>can't - the best you could do is put wildcards where you want the
>>elements from other namespaces to go. Wildcards will allow you to
>>constrain the namespace and number of elements that appear, but will
>>not validate those elements without a schema document for that
>>The examples from my XML Schema book are online at:
>>I can't guarantee they're the exact same structure as your examples,
>>but they might help.
>>Hope that helps!
>>Priscilla Walmsley email@example.com
>>Author, Definitive XML Schema (Prentice Hall PTR)
>>The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
>>initiative of OASIS <http://www.oasis-open.org>
>>The list archives are at http://lists.xml.org/archives/xml-dev/
>>To subscribe or unsubscribe from this list use the subscription
>Starbourne Communications Design
>1361-A Addison, Berkeley, CA 94702 *510-849-2309 http://www.starbourne.com *
>The information contained in this email is confidential and is intended
>for the use of the addressee only. Any unauthorised dissemination or
>copying of this email, and any use of disclosure of information
>contained in it, is strictly prohibited and may be illegal.
>Please let us know immediately by telephone if the email has been sent
>to you in error (+44 1481 711166).
Starbourne Communications Design
1361-A Addison, Berkeley, CA 94702 *510-849-2309
http://www.starbourne.com * firstname.lastname@example.org