Extending the XML DOM

Although the .NET Framework provides a suite of rich classes to navigate, query, and modify the contents of an XML document, there might be situations in which you need more functionality. For example, you might want a node class with more informative properties or a document class with extra functions. To obtain that class, you simply derive a new class from XmlNode, XmlDocument, or whatever XML DOM class you want to override. Let’s see how.

Custom Node Classes

As a general rule of thumb, you should avoid deriving node classes from the base class XmlNode. If necessary, derive node classes from a specialized and concrete node class like XmlElement or XmlAttribute. This will ensure that no key behavior of the node is lost ...

Get Applied XML Programming for Microsoft® .NET 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.