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 2001/12/22 12:37:32 UTC

DO NOT REPLY [Bug 5569] New: - does not work -- base/parent elements not recognized

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=5569>.
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=5569

<extension> does not work -- base/parent elements not recognized

           Summary: <extension> does not work -- base/parent elements not
                    recognized
           Product: Xerces-C++
           Version: 1.6.0
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Validating Parser (Schema) (Xerces 1.5 or up only)
        AssignedTo: xerces-c-dev@xml.apache.org
        ReportedBy: dkiely@ocv.com


<extension> does not work -- base/parent type elements are not recognized.

Here's an XMLSchema (bug-extension.xsd)...
------------------------------------------

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema targetNamespace="http://www.bug.com/extension"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns="http://www.bug.com/extension"
           xs:elementFormDefault="qualified"
           xs:attributeFormDefault="unqualified">

<!-- baseType will be extended -->
<xs:complexType name="baseType">
 <xs:complexContent>
  <xs:restriction base="xs:anyType">
   <xs:sequence>
    <xs:element name="firstElement" type="xs:string" />
    <xs:element name="secondElement" type="xs:string" />
   </xs:sequence>
  </xs:restriction>
 </xs:complexContent>
</xs:complexType>

<!-- extendedType is extended/derived from baseType, although baseType elements
are not recognized in instance document. -->
<xs:complexType name="extendedType">
 <xs:complexContent>
  <xs:extension base="baseType"> <!-- xerces bug! cannot extend. similar bug...
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2643 -->
   <xs:sequence>
    <xs:element name="thirdElement" type="xs:string" />
   </xs:sequence>
  </xs:extension>
 </xs:complexContent>
</xs:complexType>

<xs:element name="base" type="baseType" />

<xs:element name="extended" type="extendedType" />

<xs:element name="baseSubstitute" type="extendedType" substitutionGroup="base" />

</xs:schema>
-------------------------------------------
-------------------------------------------

Here's an instance document (bug-extension-base.xml)... This works fine.
-------------------------------------------

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

<!-- this works. baseType is a restriction of anyType. -->

<works:base xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:works="http://www.bug.com/extension"
	   xsi:schemaLocation="http://www.bug.com/extension bug-extension.xsd">

 <firstElement>first</firstElement>
 <secondElement>second</secondElement>

</works:base>
-------------------------------------------
-------------------------------------------


Here's an instance document (bug-extension-extended.xml)... This seems to have a
bug.
-------------------------------------------

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

<!-- this does not work. extendedType is an extension of baseType -->

<bug:extended xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:bug="http://www.bug.com/extension"
	   xsi:schemaLocation="http://www.bug.com/extension bug-extension.xsd">

 <firstElement>first</firstElement>
 <secondElement>second</secondElement>
 <thirdElement>third</thirdElement>

</bug:extended>
-------------------------------------------
-------------------------------------------

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