Is there a way I can disable ID/IDREF checking when using Xerces C++ SAX parser?
What I need is to be able to parse data files containing references (IDREF) to previously loaded data (ID).
For example, let's say I define books and bookmarks as follows:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="urn:ns1"
xmlns:ns1="urn:ns1"
xmlns:xs="http://ift.tt/tphNwY"
elementFormDefault="qualified">
<xs:complexType name="book_type">
<xs:attribute name="title" type="xs:ID" />
</xs:complexType>
<xs:complexType name="bookmark_type">
<xs:attribute name="title" type="xs:IDREF" />
<xs:attribute name="bookmark_type" type="xs:nonNegativeInteger" />
</xs:complexType>
<xs:element name="library">
<xs:complexType>
<xs:sequence>
<xs:element name="book" type="ns1:book_type" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="currently_reading">
<xs:complexType>
<xs:sequence>
<xs:element name="book" type="ns1:book_type" maxOccurs="unbounded" />
<xs:element name="bookmark" type="ns1:bookmark_type" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
I then extend the previous grammar:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="urn:ns2"
xmlns:ns1="urn:ns1"
xmlns:ns2="urn:ns2"
xmlns:xs="http://ift.tt/tphNwY"
elementFormDefault="qualified">
<xs:import namespace="urn:ns1" schemaLocation="ns1.xsd" />
<xs:element name="today_s_bookmarks">
<xs:complexType>
<xs:sequence>
<xs:element name="bookmark" type="ns1:bookmark_type" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Is there any way to tell Xerces to ignore book ID missing in documents defined using the second schema?
No comments:
Post a Comment