Validation against XML Schema
Posted on 2003-11-07
Is there a way of validating an XML file against a Schema so that when the XML file has an element declared like this:
where the schema defines it like:
<xsd:element name="some-field" type="xsd:nonNegativeInteger" />
as opposed to:
<xsd:element name="some-field" type="xsd:nonNegativeInteger" nillable="true" />
the parser will fire an exception?
When the element is not defined as "nillable", I don't think the XML file can have it as <some-field/>.
I am using Xerces for C++, but I guess this is ultimately a case of correctly understanding XML concepts. In code, the parser doesn't find the error and I wonder if that's normal behaviour or there is a bug somewhere.
Any help would be appreciated.