August 2003
Beginner to intermediate
600 pages
12h 57m
English
Now that you know how to move downward through a document, visiting nodes along the way, let's investigate moving horizontally through the reader, investigating attributes on elements. Since attributes appear adjacent to an element's start tag, I refer to moving through attributes as moving “horizontally” through the XML document.
One effective way to move through the attributes of an element is to set up a loop and simply read each one sequentially. The XmlTextReader provides properties and accessors to do just this. Listing 10.11 defines a method that searches the current element's attribute list looking for a specified value. The index of the attribute is returned if a matching ...
Read now
Unlock full access