Hi Mini,

At 11.50 12/07/2006 +0200, Minimol M wrote:
Hello,

I am new to Xerces-C.  I want to validate the XML file with the
schema referenced within the instance doucment if there is one, otherwise
use a schema from an external location.  For using a schema from the
external location, I use the following code and it works fine.

[...]

Can anybody tell me how I can check whether a schema is referenced in the
instance document?

You will have to parse the file in order to find out if it has the XSI attributes defined in the root element; just create a callback class that only redefine the startElement method, create a SAX2 parser, and invoke parseFirst/parseNext until your startElement is invoked and you can inspect the attributes of the root node.

Hope this helps,
Alberto

Reply via email to