122 Chapter 4 " Using XML in the .NET Framework Obviously this is not real C# code using the System.Xml classes, but it does demonstrate the idea of the NodeFilter.The nextNode() method is requesting a NodeFilter  to accept or not accept the node at the current position. It loops through all the nodes until it can find a node that the filter does not want to skip. At that point, it exits and returns the node at the current position. However, if the position goes to the end of the list, it returns null and exits the method call. DOM Range Like DOM Traversal, DOM Range is not mandatory for Level 2 XML parsers. A Level 2 parser can implement some or all of the DOM Range specification if the developers of the parser wish to do so. According to the W3C DOM Range specification, the Range interface can be seen as a convenience interface where all of the operations one can perform on the Range can be mapped to a series of node editing operations. A range in an XML document can be thought of as two boundary points.A boundary point is essentially the node that contains it, and an offset.The node is called the container of the boundary point and its position. Every container and their ancestors are ancestor containers of the boundary point and its position. If the con- tainer is an AttributeDocumentDocumentFragmentElement, or EntityReference, the offset is between its child nodes, whereas if the container is a CharacterData, Comment, or ProcessingInstructions, the offset is between characters of the string con- tained by it. See Figure 4.9 for an example of boundary points and ranges. The range denoted by the boundary points s1 and e1 both have a container of the addressBook element.The boundary point s1 has an offset of zero (0), because it is at the beginning of the container node.The corresponding end point e1 has an offset of one (1), since it points to the end of the first container in the addressBook element. Every node inside this element is considered an ancestor container of this range.The boundary point denoted by s2 has an offset of 1, since it starts at the i character, and the corresponding end boundary point www.syngress.com Figure 4.9  Boundary Point and Range Example <addressBook><category name=Friends><entry name=Bill Gates phoneNumber=555-1212" /></category></addressBook> s1 e1 s2 e2 155_xml_net_pd_C04.qk  3/6/02  1:57 PM  Page 122