[
Lists Home |
Date Index |
Thread Index
]
Hi Don,
You need two schema documents, one for the "A" namespace, and the other for
the "B" namespace. One way to accomplish what you want is to set
elementFormDefault="true" in the B schema document. That way, if you
declare C and D locally, they should be in no namespace, like they are in
your instance example. So, your 2 schema documents might look like this:
A.xsd:
<xsd:schema elementFormDefault="qualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:a" xmlns:aaa="urn:a" xmlns:bbb="urn:b">
<xsd:import namespace="urn:b" schemaLocation="B.xsd"/>
<xsd:element name="A">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="A1">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="bbb:B"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="version"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
B.xsd:
<xsd:schema elementFormDefault="unqualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:b" xmlns:bbb="urn:b">
<xsd:element name="B">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="C" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="D" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Hope that helps,
Priscilla
-----------------------------------------------------
Priscilla Walmsley http://www.datypic.com
Author, Definitive XML Schema (Prentice Hall PTR)
-----------------------------------------------------
> -----Original Message-----
> From: Don Hillsberry [mailto:don_hillsberry@hotmail.com]
> Sent: Monday, February 07, 2005 3:49 PM
> To: xml-dev@lists.xml.org
> Subject: [xml-dev] Unqualified Element without using xs:any
>
> Would someone please explain the approach used to create a
> schema capable of
> validating the following xml document without using "xs:any".
> In particular, I'm having difficulty getting past the default
> Namespace of
> the "C" and "D" elements contained within the "B" element. I
> have tried
> several different options and the only one that has worked is
> when element
> "B" is defined as <xs:any namespace="##any"/>. What other
> options are there?
>
> Thanks
> Don
>
> <aaa:A xmlns:aaa="urn:a" version="1.0">
> <aaa:A1>
> <bbb:B xmlns:bbb="urn:b">
> <C>
> <D>Text</D>
> </C>
> <C>
> <D>Text</D>
> </C>
> </bbb:B>
> </aaa:A1>
> </aaa:A>
>
>
>
> -----------------------------------------------------------------
> 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
> manager: <http://www.oasis-open.org/mlmanage/index.php>
>
>
|