O'Reilly logo

Real World XML by Steven Holzner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Navigating in XML Documents

The Node interface available when you use the DOM parser contains all the standard W3C DOM methods for navigating in a document, such as getNextSibling, getPreviousSibling, getFirstChild, getLastChild, and getParent. It's different when you use a SAX parser: 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 this document, which we'll call ch12_08.xml here:

Listing . ch12_08.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> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required