Reading XML Nodes

As you traverse the XML stream, the XmlTextReader will be a pointer to each node that is encountered. Once the XmlTextReader points at a valid node, there are four pieces of vital information that you can query for: Node Name, Node Namespace, Node Value, and Node Attributes. The XmlTextReader has accessors for each of these properties, but not all of them are applicable to every node type. The node value and node attributes properties are directly dependent on the type of the current node.

The node value property depends directly on the node type. Table 10.2 shows which node types have a value and the actual value that is returned for each. If the node type is not in the list, String.Empty is returned.

Table 10.2. XML Nodes ...

Get Microsoft® .NET Compact Framework Kick Start now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.