You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by bu...@apache.org on 2002/04/18 06:19:22 UTC

DO NOT REPLY [Bug 8236] New: - Problem with recursive and derived elements

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8236>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8236

Problem with recursive and derived elements

           Summary: Problem with recursive and derived elements
           Product: Xerces-C++
           Version: 1.7.0
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Validating Parser (Schema) (Xerces 1.5 or up only)
        AssignedTo: xerces-c-dev@xml.apache.org
        ReportedBy: thomas.rothfuss@homag.de


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.

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org