Schema: problem with order of fields in extended element

  • Thread starter Maciej Zoltowski
  • Start date
M

Maciej Zoltowski

Hi,

I've got a following problem with the order of fields in extended
element: let's assume, that I have a complex type with a few fields,
that I want to extend with additional field. In extended type I would
like to have the possibility of entering fields (both from base and
extended type) in any order, but during validation XMLSPY shows me an
error. What am I doing wrong?

Sample schema definition:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="tmp">
<xs:complexType>
<xs:complexContent>
<xs:extension base="tmp2">
<xs:all minOccurs="0">
<xs:element name="c" minOccurs="0"/>
</xs:all>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:complexType name="tmp2">
<xs:all>
<xs:element name="a" minOccurs="0"/>
<xs:element name="b" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:schema>

and the sample incorrect data file:
<?xml version="1.0" encoding="UTF-8"?>
<tmp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="tmp.xsd">
<a>Text</a>
<c>Text</c>
<b>Text</b>
</tmp>

Regards
Maciek
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top