Java Reference
In-Depth Information
}
}
public void fatalError(SAXParseException spe) throws SAXException {
System.out.println("Fatal error at line "+spe.getLineNumber());
System.out.println(spe.getMessage());
throw spe;
}
public void warning(SAXParseException spe) {
System.out.println("Warning at line "+spe.getLineNumber());
System.out.println(spe.getMessage());
}
public void error(SAXParseException spe) {
System.out.println("Error at line "+spe.getLineNumber());
System.out.println(spe.getMessage());
}
}
I have removed the statement outputting details of the parser to reduce the output a little. Run this with
the version of Address.xml that includes a DOCTYPE declaration. The program produces quite a lot of
output starting with:
DOCTYPE node:
org.apache.crimson.tree.Doctype@decdec
Document body contents are:
address Node, type is org.apache.crimson.tree.ElementNode2:
<address>
<buildingnumber> 29 </buildingnumber>
<street> South Lasalle Street</street>
<city>Chicago</city>
<state>Illinois</state>
<zip>60603</zip>
/address>
Child Nodes of address are:
#text Node, type is org.apache.crimson.tree.TextNode:
buildingnumber Node, type is org.apache.crimson.tree.ElementNode2:
<buildingnumber> 29 </buildingnumber>
Child Nodes of buildingnumber are:
#text Node, type is org.apache.crimson.tree.TextNode:
29
#text Node, type is org.apache.crimson.tree.TextNode:
and so on down to the last few lines:
zip Node, type is org.apache.crimson.tree.ElementNode2:
<zip>60603</zip>
Search WWH ::




Custom Search