You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by DANA CORDES <dc...@nhbb.com> on 2002/08/29 18:16:25 UTC
XML Parsing and Debugging
We have a large web application that uses Xerces and Xalan for HTML
rendering via XSL. Occasionally during our XSL development we have bugs.
I know that's hard to believe, but we do, and it's often difficult to
determine exactly where in the XSL these problems occure, so I was
wondering if Xerces has any kind of more verbose error reporting than is
described in on the Xerces pages and as follows:
import javax.xml.parsers.DocumentBuilder;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
ErrorHandler handler = new ErrorHandler() {
public void warning(SAXParseException e) throws SAXException {
System.err.println("[warning] "+e.getMessage());
}
public void error(SAXParseException e) throws SAXException {
System.err.println("[error] "+e.getMessage());
}
public void fatalError(SAXParseException e) throws SAXException {
System.err.println("[fatal error] "+e.getMessage());
throw e;
}
};
DocumentBuilder builder = /* builder instance */;
builder.setErrorHandler(handler);
This will give the error, but no indication where in the XSL the error is
occuring, as follows:
[fatal error] The element type "xsl:apply-templates" must be terminated by
the m
atching end-tag "</xsl:apply-templates>".
Ideally I'd like line and character numbers so my team can more quickly
identify the problem locations.
Dana Cordes
Senior Programmer/Analyst
Information Technologies
New Hampshire Ball Bearing
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org