Navigating in XML Documents

The Node interface available that is when you use the DOM parser contains all the standard W3C DOM methods for navigating in a document, including getNextSibling, getPreviousSibling, getFirstChild, getLastChild, and getParent. It's different when you use a SAX parser, however, because this parser does not create a tree of nodes, so those methods don't apply.

Instead, if you want to find a particular element, you have to find it yourself. In the previous chapter, I found the third person's name in meetings.xml:

 <?xml version="1.0"?> <MEETINGS> <MEETING TYPE="informal"> <MEETING_TITLE>XML In The Real World</MEETING_TITLE> <MEETING_NUMBER>2079</MEETING_NUMBER> <SUBJECT>XML</SUBJECT> <DATE>6/1/2002</DATE> <PEOPLE> <PERSON ...

Get Inside XML 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.