Accessing an Element's Attributes
In most cases, navigating an XmlDocument node tree involves moving through parent-child relationships, except when you are accessing an element's attributes. The element-attribute relationship is a container-contained relationship. Since the XmlNode is an abstract class that represents the common functionality of all XML nodes, it provides only minimal functionality for accessing attribute information. Since attributes are most meaningful on XML elements, the XmlElement class provides a richer API for retrieving attribute information. In this section we will investigate the methods available on both classes.
The XmlNode class exposes the Attributes property to access its attributes. The Attributes property returns ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access