Java Reference
In-Depth Information
<?xml version="1.0"?>
<!DOCTYPE address SYSTEM "AddressDoc.dtd">
<address>
<buildingnumber> 29 </buildingnumber>
<street> South Lasalle Street</street>
<city>Chicago</city>
<state>Illinois</state>
<zip>60603</zip>
</address>
The AddressDoc.dtd file in the same directory as Address.xml should contain:
<!ELEMENT address (buildingnumber, street, city, state, zip)>
<!ELEMENT buildingnumber (#PCDATA)>
<!ELEMENT street (#PCDATA)>
<!ELEMENT city (#PCDATA)>
<!ELEMENT state (#PCDATA)>
<!ELEMENT zip (#PCDATA)>
If the path to the file contains spaces you will need to specify the path between double quotes in the
command line argument. I got the output:
Parser will be namespace aware
Parser will validate XML
Parser object is: org.apache.xerces.jaxp.SAXParserImpl@c9ba38
Starting parsing of Address.xml
Start document:
Start element: local name: address qname: address uri:
Ignorable whitespace:
Start element: local name: buildingnumber qname: buildingnumber uri:
Characters: 29
End element: local name: buildingnumber qname: buildingnumber uri:
Ignorable whitespace:
Start element: local name: street qname: street uri:
Characters: South Lasalle Street
End element: local name: street qname: street uri:
Ignorable whitespace:
Start element: local name: city qname: city uri:
Characters: Chicago
End element: local name: city qname: city uri:
Ignorable whitespace:
Start element: local name: state qname: state uri:
Characters: Illinois
End element: local name: state qname: state uri:
Ignorable whitespace:
Search WWH ::




Custom Search