Schema: problem with order of fields in extended element

Discussion in 'XML' started by Maciej Zoltowski, Dec 5, 2003.

  1. 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
    Maciej Zoltowski, Dec 5, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page