Hour 8. Traversing the Node Tree and Adding and Replacing Nodes

In previous hours, you traversed the nodes of an XML tree by determining the number of nodes and then indexing on the array of nodes. While this method does allow you to move through the nodes, there's another way to do it. You can use the properties of firstChild, lastChild, nextSibling, and previousSibling. The first part of this hour will introduce these properties.

Although reading the nodes from a file is an important operation, performing updates is almost always an essential aspect of any work with databases. The insertion of additional nodes into the XML tree that's currently in active memory is the second item on the agenda for this hour.

In this hour, you'll learn the ...

Get Sams Teach Yourself XML in 24 Hours 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.