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
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