Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.6.0, 2.7.0
-
None
-
Windows XP
Description
When trying to the following schema in Xerces 2.6, it complains that the base type of CV does not have any attribute defined (Line: 34 Column: 31
Base type definition does not have any attributes). Apparently, we see attribute defined in CE (the base type of CV).
The problem seems to be caused by element "qualifier" in complexType "CD". The element "qualifier" has type of CR which contains an element of type CV which is a derivative of CE, which in turns is the derivative of CD. Xerces trys to resolve CE before attributes in CD is processed and thus the error.
Although the syntax looks wierd, it is from a govenment stanadard and we have no position of changing that.
A workaround is to move definition of CR ahead of CD. However, since the position of element definition in Schema should have no effect on validation, we think Xerces should report no error as it is.
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="urn:hl7-org:v3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:hl7-org:v3"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:complexType name="ANY" abstract="true"></xsd:complexType>
<xsd:complexType name="CD">
<xsd:complexContent>
<xsd:extension base="ANY">
<xsd:sequence>
<xsd:element name="qualifier" type="CR"
minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="code" use="optional"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="CE">
<xsd:complexContent>
<xsd:restriction base="CD">
<xsd:sequence>
</xsd:sequence>
<xsd:attribute name="code" use="optional"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="CV">
<xsd:complexContent>
<xsd:restriction base="CE">
<xsd:sequence>
</xsd:sequence>
<xsd:attribute name="code" use="optional"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="CR">
<xsd:complexContent>
<xsd:extension base="ANY">
<xsd:sequence>
<xsd:element name="name" type="CV" minOccurs="0"
maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="inverted" use="optional"
default="false"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="root" type="CV" />
</xsd:schema>