13.4. XML basics

To begin, examine the file cdlist1.xml shown in Figure 404 on page 545. This is a simple XML file that contains a list of CDs. The entire XML document forms a tree structure. There is always one root element in an XML document, in this case <cdlist>. The children of cdlist are CDs. Each CD is a node that has children, such as title and artist. These nodes have leaf nodes with text values such as “Steely Dan”. XML parsers read through an XML file transforming it into a tree structure called a Document Object Model (DOM) that can be manipulated in different ways. For example, the CD nodes could be reordered (conceptually from left to right under their cdlist parent) to sort them by title or by artist.

Figure 404. cdlist1.xml (partial) ...

Get WebSphere V3.5 Handbook 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.