|
try{
// instantiate a parser of type com.ibm.xml.parser.Parser
Parser parser = new Parser(argv[0]);
// org.w3c.dom.Document is part of XML4J distribution
Document doc = parser.readStream(is);
// Did the document contain any errors?
if (parser.getNumberOfErrors() > 0) {
System.out.println(“Errors have been found with the Document!”)
}
} catch (Exception e) {
e.printStackTrace();
}
|