See Also: XPathDocument Members
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.