use of org.apache.jena.rdfxml.xmlinput.impl.XMLHandler in project jena by apache.
the class TestPropEltErrorMsg method runTest.
@Override
protected void runTest() {
Attributes noAtts = new Atts();
final StringBuffer buf = new StringBuffer();
XMLHandler arp = new XMLHandler();
arp.getHandlers().setErrorHandler(new ErrorHandler() {
@Override
public void warning(SAXParseException exception) {
buf.append(exception.getMessage());
buf.append("\n");
}
@Override
public void error(SAXParseException e) {
warning(e);
}
@Override
public void fatalError(SAXParseException e) {
warning(e);
}
});
try {
arp.initParse("http://example.org/", "");
arp.startElement(RDF.getURI(), "RDF", "rdf:RDF", noAtts);
arp.startElement(RDF.getURI(), "Description", "rdf:Description", noAtts);
arp.startElement(RDF.getURI(), "value", "rdf:value", testAtts);
} catch (SAXException e) {
}
// System.err.println("===");
// System.err.println("\""+getName()+"\",");
// System.err.println("---");
String contents = buf.toString();
// System.err.println("\""+(contents.length()>7?contents.substring(7).replace("\n","\\n"):"")+"\",");
assertEquals("test data muddled", rslts[n * 2], getName());
assertTrue("error message has changed.", contents.endsWith(rslts[n * 2 + 1]));
contents = null;
}
Aggregations