Zoo tutorials: [ SQL | Java | Linux | XML ]

A Gentle Introduction to xml

Looping through DOM

Question 1: nextSibling

nextSibling will return the node to the right - or null if we are at the last sibling.

Take a look at the file cia.xml, it contains an element for every node taken from the cia world factbook.

Java DOM

Question 2: Node Lists

The method getElementsByTagName(t) is a handy method of Document. It returns a NodeList - this in turn has two methods item(i) and getLength()

Java DOM