|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Unqualified Element without using xs:any
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@h...]
> Sent: Monday, February 07, 2005 3:49 PM
> To: xml-dev@l...
> Subject: 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>
>
>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








