Saturday, August 25, 2007

Process XML with JDOM

Look ma, no Nodes: Building and manipulating JDOM documents

JDOM makes use of standard Java coding patterns. Where possible, it uses the Java new operator instead of complex factory patterns, making object manipulation easy, even for the novice user. For example, let's look at how you would build a simple XML document from scratch using JDOM. The structure we are going to build is shown in Listing 1. (Download the complete code for this article from Resources.)

Listing 1. Sample XML document to build




Toyota
Celica
1997
green
1ABC234

No comments: