Hi all,

I want to validate an XML file to a schema, but the XML file doesn't have a reference to that schema. I want to use the setProperty function of the DOMBuilder to set an external schema, without namespaces, but this doesn't seem to work.

Here is the (head of the) XML file I want to validate:
<JobqueueXML>
       <MessageNumber>2483920</MessageNumber>
...

This is the (head of the) XMLSchema:
<xs:schema
       attributeFormDefault="unqualified"
elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema";>
 <xs:element name="JobqueueXML">
...

The Schema definition is correct and when I reference the Schema in the XML file, it gets validated, but the files I get (I do not produce them myself) do not have the reference in it, so I want to set it this way:
   parser->setProperty (XMLUni::
                fgXercesSchemaExternalNoNameSpaceSchemaLocation,
                "job.xsd");

Where 'job.xsd' is the Schema file. 'parser' is a DOMBuilder object, as defined in the DOMCount sample program (I used that as reference). However, this does not work. There is no validation at all, even if I change the name into something unresolvable (e.g. a non-existing file) it gives no error.

Could someone give me some help on how to fix this?

TIA
Bart Friederichs

Reply via email to