Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your <code>xmlDoc</code> object is of type <code>XmlDocument</code>, and <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmldocument_properties.aspx" rel="nofollow">XmlDocument does not have a property called Root</a>. </p> <p>To access the root of an <code>XmlDocument</code>, use the <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.documentelement.aspx" rel="nofollow">DocumentElement</a> property</p> <pre><code>XmlElement root = xmlDoc.DocumentElement; </code></pre> <p>It should be noted <code>DocumentElement</code> is of type <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlelement.aspx" rel="nofollow">XmlElement</a>, and <code>XmlElement</code> does not contain a property called <code>Elements</code>, so you'll need to look up the alternative to that property if you choose to stick with <code>XmlDocument</code></p> <p>But in your case, you are probably getting <code>XmlDocument</code> mixed up with the <a href="http://msdn.microsoft.com/en-us/library/system.xml.linq.xdocument.aspx" rel="nofollow">XDocument</a> class, which <em>does</em> contain a property called <code>Root</code> of type <a href="http://msdn.microsoft.com/en-us/library/system.xml.linq.xelement.aspx" rel="nofollow">XElement</a>, and <code>XElement</code> contains an <code>Elements</code> property. </p> <p>So either replace your <code>XmlDocument</code> with an <code>XDocument</code>, or rewrite your linq query to use the <code>XmlDocument</code> syntax.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload