Root node is the DocumentElement
property of XmlDocument
XmlElement root = xmlDoc.DocumentElement
If you only have the node, you can get the root node by
XmlElement root = xmlNode.OwnerDocument.DocumentElement
More Related Contents:
- Deserialize XML To Object using Dynamic
- Why does C# XmlDocument.LoadXml(string) fail when an XML header is included?
- xml.LoadData – Data at the root level is invalid. Line 1, position 1
- Query an XDocument for elements by name at any depth
- String escape into XML
- Serializing an object as UTF-8 XML in .NET
- Serialize a nullable int
- how to read all files inside particular folder
- How to prevent blank xmlns attributes in output from .NET’s XmlDocument?
- How to check if a file exists in a folder?
- Adding elements to an xml file in C#
- How to define multiple names for XmlElement field?
- Passing parameters to XSLT Stylesheet via .NET
- Modify XML existing content in C#
- How to create XmlElement attributes with prefix?
- Parsing XML using XDocument
- Convert an object to an XML string
- How to use XPath function in a XPathExpression instance programatically?
- Binding properties in code behind
- Deserialize object property with StringReader vs XmlNodeReader
- Use the XmlInclude or SoapInclude attribute to specify types that are not known statically
- Case insensitive XML parser in c#
- Read from xml files with or without a namespace using XmlDocument
- Automating replacing tables from external files
- Finding element in XDocument?
- Check if XML Element exists
- How can I remove empty xmlns attribute from node created by XElement
- Reading specific XML elements from XML file
- Reading XML comments in C#
- Parsing SVG “path” elements with C# – are there libraries out there to do this? [closed]