Xerces C++ API - Parser problems
Posted on 2003-11-04
I have a problem with the parser and I am not sure whether it is a bug or I am doing something wrong.
The XML Schema defines a field like this:
<xsd:element name="some-field" type="xsd:positiveInteger" />
Inside the XML file that I need to parse, there are cases when this field is present or is absent.
When the field is completely absent, the parser raises an error. However, when I have a tag like this
<image-number/> the parser doesn't raise the error. It parses the message as if everything is fine. This causes me problems because according to the schema, I expect there a value.
Now, in the schema (as it can be seen) there is no provision for the field to be nillable.
For that, the element should have been defined like this:
<xsd:element name="some-field" type="xsd:positiveInteger" nillable="true"/>
Is this a bug or that is the way the parser is suppose to behave? I would have expected the parser to catch the case when the value of the field is not present.
Any help would be very much appreciated.