Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using xs:all with extension base 1

Status
Not open for further replies.

cusebassman

Programmer
Dec 21, 2007
1
US
Sorry if this has been covered, but I cannot find info on it to save my life. I am, generically, dealing with the following schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="
<xs:complexType name="base1">
<xs:complexContent>
<xs:restriction base="xs:anyType">
<xs:attribute name="name" type="xs:string"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="base">
<xs:complexContent>
<xs:extension base="base1">
<xs:all>
<xs:element name="first"/>
<xs:element name="second"/>
<xs:element name="third"/>
</xs:all>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:element name="specificType1">
<xs:complexType>
<xs:complexContent>
<xs:extension base="base">
<xs:all>
<xs:element ref="item1" minOccurs="0" maxOccurs="1"/>
<xs:element ref="item2" minOccurs="0" maxOccurs="1"/>
<xs:element ref="item3" minOccurs="0" maxOccurs="1"/>
<xs:element ref="item4" minOccurs="0" maxOccurs="1"/>
</xs:all>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>

</xs:schema>

This yields an error saying that:

"SystemID: ____ /Untitled2.xsd
Location: 28:22
Description: cos-all-limited.1.2: An all model group must appear in a particle with {min occurs} = {max occurs} = 1, and that particle must be part of a pair which constitutes the {content type} of a complex type definition.
URL:
I am knew to schemas, so this may very well be extremely wrong. What I need to be able to do is use the "all" tag since the xml I am validating with this schema has to NOT care about order of information, but there are going to be multiple "specificType#" items that all need to use that "base" as an extension.
 
You have to wrap each group of xs:all into an element of its own and then extend complexType base1 into complexType base where you use xs:sequence to order the two wrapper elements. Without that wrapping element, the resultant schema would always be ambiguous which the wxsl _at present_ opted to avoid.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top