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 Martin LIENDL <Ma...@cern.ch> on 2002/09/26 15:51:27 UTC
xercesc 2.1, schema support for 'unique', 'key'
Hi,
I don't think I should send this to the general discussion list.
As there's no xerces-c user's - list, I have sent it to the developers list ...
Please have a look at the small schema catalog.xsd below, and the small instance
document catalog.xml.
I want to have all values of the 'name'-attributes of the 'file'-elements
contained in the 'catalog'-element to be unique . It seems, that xerces-c
(using the SAX2Count-example) does the uniqueness checking only on
children of the 'catalog'-element but not on all of its descendants,
as requested by the xpath selector './/file'.
Is this a bug, or a missinterpretation of the unique-concept on my side?
Thanks for any help!
Martin
=== catalog.xsd ===
<?xml version = "1.0" encoding = "UTF-8"?>
<xs:schema xmlns:xs = "http://www.w3.org/2001/XMLSchema">
<xs:element name="catalog">
<xs:complexType>
<xs:sequence>
<xs:element ref="file" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:unique name="filename">
<xs:selector xpath=".//file"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
<xs:complexType name="fileType">
<xs:sequence>
<xs:element ref="file" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string"/>
</xs:complexType>
<xs:element name="file" type="fileType"/>
</xs:schema>
=== catalog.xml ===
<?xml version = "1.0" encoding = "UTF-8"?>
<catalog xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation = "catalog.xsd">
<file name="A"/>
<file name="B">
<file name="B"> <!-- xerces should complain about 'B'... -->
<file name="C"/>
</file>
</file>
</catalog>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org