I'm parsing an XML file with Xerces and DOM. I validate my XML Instance
against a schema without problems.
I'd like to obtain some schema information on the nodes though, in
particular, I'd like to know what type they are declared to be in the
schema.
I understand that this information can be found through the PSVI, but I
can't seem to access it. When I try to obtain my schema information by
using:
rootPSVI.getSchemaInformation()
I get null.
Using a debugger, I can also see that all the information concerning
validation and PSVI is not affected. Validation is performed though, I
can see the errors in case of an invalid XML instance.

Is there something I forgot to do ? Is there another way to access this ?
Thank you for your help.

Charles

Here is the code I use:
DOMParser parser = new DOMParser();
ErrorHandler handler = new ErrorHandler() {
//Simple ErrorHandler definition here
};
parser.setErrorHandler(handler);
parser.setProperty("http://apache.org/xml/properties/dom/document-class-name","org.apache.xerces.dom.PSVIDocumentImpl";);
parser.setFeature("http://xml.org/sax/features/validation";, true);
parser.setFeature("http://apache.org/xml/features/validation/schema";, true);
parser.setFeature("http://apache.org/xml/features/validation/schema-full-checking",true);
parser.setFeature("http://xml.org/sax/features/namespaces",true);
parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",false);
parser.parse(file.toURI().toString());
Document doc = parser.getDocument();
Element e = doc.getDocumentElement();
ElementPSVI rootPSVI = (ElementPSVI)(doc.getDocumentElement());
XSModel schema = rootPSVI.getSchemaInformation();

following this line, schema is always null.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to