I'd like to use following schema (dummy.xsd):

<?xml version="1.0" encoding="UTF-8"?>


<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
     xmlns:pr="http://www.homag.de/proresult";
     targetNamespace="http://www.homag.de/proresult";
     elementFormDefault="qualified"
     attributeFormDefault="unqualified">


  <xs:attributeGroup name="AttrDERIVED1">
    <xs:attribute name="Derived1Name"                       type
="xs:string"                    use="required"/>
  </xs:attributeGroup>

  <xs:complexType name="DERIVED1">
    <xs:complexContent>
      <xs:extension base="pr:BASE">
        <xs:attributeGroup ref="pr:AttrDERIVED1"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>



  <xs:attributeGroup name="AttrDERIVED2">
    <xs:attribute name="Derived2Name"                       type
="xs:string"                    use="required"/>
  </xs:attributeGroup>

  <xs:complexType name="DERIVED2">
    <xs:complexContent>
      <xs:extension base="pr:BASE">
        <xs:attributeGroup ref="pr:AttrDERIVED2"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>




  <xs:attributeGroup name="AttrDERIVED3">
    <xs:attribute name="Derived3Name"                       type
="xs:string"                    use="required"/>
  </xs:attributeGroup>

  <xs:complexType name="DERIVED3">
    <xs:complexContent>
      <xs:extension base="pr:BASE">
        <xs:attributeGroup ref="pr:AttrDERIVED3"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>




  <xs:attributeGroup name="AttrBASE">
    <xs:attribute name="BaseName"                           type
="xs:string"                    use="required"/>
  </xs:attributeGroup>

  <xs:complexType name="BASE">
    <xs:sequence
      minOccurs="0" maxOccurs="unbounded">
      <xs:element name="BASE"                               type="pr:BASE"
minOccurs="0" maxOccurs="1"/>
    </xs:sequence>
    <xs:attributeGroup ref="pr:AttrBASE"/>
  </xs:complexType>



  <xs:element name="PRORESULT">
    <xs:complexType>
      <xs:all>
        <xs:element name="BASE"                             type="pr:BASE"
minOccurs="0" maxOccurs="1"/>
      </xs:all>
    </xs:complexType>
  </xs:element>

</xs:schema>


There are a base type ("BASE") and  3 derived types
("DERIVED1".."DERIVED3").
A BASE type can contain itself recursively.


Calling the XERCES parser (V.1.7.0, latest stable version) with the xml
file below (pparse -v=always -n -s -f dummy.xml) causes an error:
 Message: Type 'pr:DERIVED3' that is used in xsi:type is not derived from
the type of element 'BASE'


<?xml version="1.0" encoding="iso-8859-1"?>
<pr:PRORESULT xmlns:pr="http://www.homag.de/proresult";
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
               xsi:schemaLocation="http://www.homag.de/proresult
dummy.xsd">

  <pr:BASE xsi:type="pr:DERIVED1" BaseName="Base" Derived1Name="Derived1a">
    <pr:BASE xsi:type="pr:DERIVED2" BaseName="Base" Derived2Name
="Derived2a">
      <pr:BASE xsi:type="pr:DERIVED3" BaseName="Base" Derived3Name
="Derived3a">
      </pr:BASE>
    </pr:BASE>
  </pr:BASE>
</pr:PRORESULT>


Using element DERIVED2 instead of DERIVED3 works.


My questions are:
1. Is it allowed to use recursive types containing itself?
2. Are there limits for derivations?
3. Or is it a Xerces bug?


Thanks in advance.


Regards
Thomas


[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to