Example usage for org.xml.sax SAXParseException toString

List of usage examples for org.xml.sax SAXParseException toString

Introduction

In this page you can find the example usage for org.xml.sax SAXParseException toString.

Prototype

public String toString() 

Source Link

Document

Override toString to provide more detailed error message.

Usage

From source file:org.geoserver.csw.CSWTestSupport.java

/**
 * Validates a document against the//from  w w w .ja v  a 2 s .  c  om
 * 
 * @param dom
 * @param configuration
 */
protected void checkValidationErrors(Document dom, Configuration configuration) throws Exception {
    Parser p = new Parser(configuration);
    p.setValidating(true);
    p.parse(new DOMSource(dom));

    if (!p.getValidationErrors().isEmpty()) {
        for (Iterator e = p.getValidationErrors().iterator(); e.hasNext();) {
            SAXParseException ex = (SAXParseException) e.next();
            System.out.println(ex.getLineNumber() + "," + ex.getColumnNumber() + " -" + ex.toString());
        }
        fail("Document did not validate.");
    }
}

From source file:org.onehippo.repository.xml.EnhancedSystemViewImportHandler.java

public void error(SAXParseException e) throws SAXException {
    log.error("error encountered at line: " + e.getLineNumber() + ", column: " + e.getColumnNumber()
            + " while parsing XML stream: " + e.toString());
}

From source file:org.onehippo.repository.xml.EnhancedSystemViewImportHandler.java

public void fatalError(SAXParseException e) throws SAXException {
    log.error("fatal error encountered at line: " + e.getLineNumber() + ", column: " + e.getColumnNumber()
            + " while parsing XML stream: " + e.toString());
    throw e;/* w ww . j a  v a2 s . co m*/
}