Creating a DOM Application
In our context, a DOM application is a Java application that implements the javax.xml.parsers and org.w3c.dom packages to process an XML document by creating a DOM from it. You will create such an application and call it MyDOMHandler.java. The XML file you will use is the same CarParts.xml file that we used to explain the workings of a SAX parser.
The CarParts.xml File
The CarParts.xml file is displayed in Listing 5.2.
Listing 5.2. The CarParts.xml File
<?xml version='1.0' encoding='us-ascii'?> <!-- XML file that describes car parts --> <!DOCTYPE carparts SYSTEM "CarParts.dtd" [ <!ENTITY companyname "Heaven Car Parts (TM)"> <!ENTITY companyweb "http://carpartsheaven.com"> ]> <carparts> <?supplierformat format="X13" ... |
Get Java™ APIs for XML Kick Start now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.