
such as text or entities. As you will see, more complex applications have to
examine all the nodes.
At each step, the function tests whether the current node is a price. For
each price element, it computes the price in Euros and prints it.
Next, the function turns to the node’s children. It loops through all the chil-
dren and recursively calls itself for each child.
To walk through the node’s children, the function accesses the
childNodes
property. childNodes contains a NodeList. NodeList is a DOM object that
contains a list of Node objects. It has two properties:
• length, the number of nodes in the list.
• item(i), a method to access node i in the ...