Additional DOM Processing Considerations and Strategies

We talked in Chapters 2 and 3 about some basic DOM programming techniques. We're starting to deal with more complex documents, so it is appropriate to discuss some more advanced topics and potholes on the road to creating robust DOM programs that are easy to maintain.

A primary consideration is whether we want to retrieve data from a DOM document by name or whether we want to traverse the document tree in some particular order and process things as we encounter them. To access data by name we can use a few basic methods. The ones listed below are sufficient for the points I want to make, although other methods are also available.

  • getElementsByTagName: retrieves an Element by its name, returning ...

Get Using XML with Legacy Business Applications 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.