Mono Class Library: System.Xml.XPath Namespace

System.Xml.XPath.XPathDocument Class

Represents an XML document and provides a read access to the document navigator. [Edit]

See Also: XPathDocument Members

public class XPathDocument : IXPathNavigable

Remarks

This class implements IXPathNavigable interface and class provides a fast and readonly access to the document through System.Xml.XPath.XPathNavigator.

There are two IXPathNavigable implementations in System.Xml.dll. One is XmlDocument and it creates the XPathNavigator that is based on its own Document Object Model. XPathDocument is the another one and it creates the XPathNavigator that is readonly and optimized to navigate the document.

Note: XmlDocument's XPathNavigator is many times slower than that of this class when it is used to navigate previous siblings.

To create compatible XPathNavigator to that of XmlDocument, XmlValidatingReader is required to create the internal document structure from source (otherwise, no ID type attributes are recognized and thus XPathNavigator.MoveToId method will result in different navigation). When an XPathDocument is constructed from URI string or Stream, it creates XmlValidatingReader.

Note: In contrast, using XmlTextReader instead of URI string, Stream, or TextReader enables performance boost, since XmlValidatingReader is slower than XmlTextReader.

To keep whitespace nodes in the document, System.Xml.XmlSpace.Preserve is required in the constructor (to keep compatibility with XPathDocument, System.Xml.XmlDocument.PreserveWhitespace must be set to true.

[Edit]

Requirements

Namespace: System.Xml.XPath
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0