I wrote a Java class which implements the DOMErrorHandler interface (Xerces). This class aims at validating an XML instance against an XML schema. The parser used to parse and compare the schema and the XML instance is a DOMASBuilder (Xerces). When the XML instance doesn't fit to the XML schema, a DOMError is thrown and processed by a handleError method which code looks like :
public boolean handleError(DOMError error) { System.err.print("["); switch ( error.getSeverity() ) { case DOMError.SEVERITY_WARNING: System.err.print("Warning"); break; case DOMError.SEVERITY_ERROR: System.err.print("Error"); break; case DOMError.SEVERITY_FATAL_ERROR: System.err.print("Fatal Error"); break; } System.err.print("] "); ... // Node in error -> NODE IS ALWAYS EMPTY !!?? DOMLocator domLoc = error.getLocation(); Node errNode = domLoc.getErrorNode(); if ( errNode != null ) { String strNodeName = errNode.getNodeName(); String strNodeValue = errNode.getFirstChild().getNodeValue(); } return error.getSeverity() != DOMError.SEVERITY_FATAL_ERROR; } My problem is that I can't get the XML instance's node in error. The DOMError.getLocation().getErrorNode() instruction should return a reference to the node in the XML instance which doesn't respect the grammar in the schema. This reference is always a null pointer ! Does anybody know which parameter/option should I set to get the information on the node in error ?? Thanks a lot. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]