1

Closed

ReadElement should allow XPath of "/" to read entire document

description

This may seem like a silly request, but when repackaging / cobbling together Xml files (for instance into a master SQL script), it may be useful to get the Xml of an entire document, rather than using ReadAllText against the file.
 
Only a simple change is required for the ReadElement method to support this.
 
Old:
        XmlNode node = this.xmlFileDoc.SelectSingleNode(this.XPath, this.namespaceManager);
        if (node != null && node.NodeType == XmlNodeType.Element)
 
New:
 
        XmlNode node = this.xmlFileDoc.SelectSingleNode(this.XPath, this.namespaceManager);
        if (node != null && (node.NodeType == XmlNodeType.Element || node.NodeType == XmlNodeType.Document))
Closed Apr 11, 2012 at 9:36 PM by mikeFourie

comments

wrote Apr 11, 2012 at 9:36 PM

Resolved with changeset 75471.