Java Reference
In-Depth Information
<!ELEMENT buildingnumber (#PCDATA)>
<!ELEMENT street (#PCDATA)>
<!ELEMENT city (#PCDATA)>
<!ELEMENT state (#PCDATA)>
<!ELEMENT zip (#PCDATA)>
]>
<address>
<buildingnumber> 29 </buildingnumber>
<street> South Lasalle Street</street>
<city>Chicago</city>
<state>Illinois</state>
<zip>60603</zip>
</address>
Directory "TryDOM 2 with node details output"
This is the Address.xml document from the previous chapter with the DTD included in the document. If
you store this file in the same directory as the source file, you can just put the file name as the command-
line argument, like this:
java TryDOM AddressWithDTD.xml
The program produces quite a lot of output starting with:
DOCTYPE node:
<!ELEMENT address (buildingnumber,street,city,state,zip)>
<!ATTLIST address xmlns CDATA #IMPLIED>
<!ELEMENT buildingnumber (#PCDATA)>
<!ELEMENT street (#PCDATA)>
<!ELEMENT city (#PCDATA)>
<!ELEMENT state (#PCDATA)>
<!ELEMENT zip (#PCDATA)>
Document body contents are:
Node: address
Node Type: Element
Child Nodes of address are:
Node: #text
Node Type: Text
Node: buildingnumber
Node Type: Element
Child Nodes of buildingnumber are:
Node: #text
Node Type: Text
and so on down to the last few lines:
Node: zip
Node Type: Element
Child Nodes of zip are:
Node: #text
Search WWH ::




Custom Search