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))
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))