Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It sounds a little like you could benefit from <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx" rel="nofollow noreferrer"><code>XmlSerializer</code></a> by using the <a href="http://msdn.microsoft.com/en-us/library/dk9cbaf1.aspx" rel="nofollow noreferrer"><code>Deserialize()</code></a> method.</p> <p>Here are a few links showing an example: </p> <p><a href="https://stackoverflow.com/questions/1081325/c-sharp-how-to-xml-deserialize-object-itself">C# - How to xml deserialize object itself?</a></p> <p><a href="https://stackoverflow.com/questions/4085529/c-sharp-deserialize-xml-to-object">C# Deserialize XML to object</a></p> <p>I think that is a possible way to go, otherwise you could parse it into <a href="http://msdn.microsoft.com/en-us/library/system.xml.linq.xdocument.aspx" rel="nofollow noreferrer"><code>XDocument</code></a> or <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx" rel="nofollow noreferrer"><code>XmlDocument</code></a> and navigate through the document with XPath. By the way you can use the <a href="http://msdn.microsoft.com/en-us/library/875kz807.aspx" rel="nofollow noreferrer"><code>Load()</code></a> method on <code>XmlDocument</code> to load a string of XML</p> <pre><code> string xmlString = "&lt;root&gt;&lt;sub&gt;&lt;/sub&gt;&lt;/root&gt;"; XmlDocument doc = new XmlDocument(); doc.Load(xmlString); </code></pre> <p>or the <a href="http://msdn.microsoft.com/en-us/library/system.xml.linq.xdocument.parse.aspx" rel="nofollow noreferrer"><code>Parse()</code></a> method of <code>XDocument</code> to load a string of XML into the object.</p> <pre><code>string str = @"&lt;Root&gt; &lt;Child&gt;Content&lt;/Child&gt; &lt;/Root&gt;"; XDocument doc = XDocument.Parse(str); </code></pre> <p>Unsure which technique to use, take a look here:</p> <p><a href="https://stackoverflow.com/questions/1542073/xdocument-or-xmldocument">XDocument or XmlDocument</a></p> <p>I even managed to find an example from Google that will get you started: <a href="http://www.codeproject.com/Articles/169598/Parse-XML-Documents-by-XMLDocument-and-XDocument" rel="nofollow noreferrer">http://www.codeproject.com/Articles/169598/Parse-XML-Documents-by-XMLDocument-and-XDocument</a></p> <p>Another route is to use the Linq2Xml technique and again here is another question which will show you how it is achieved:</p> <p><a href="https://stackoverflow.com/questions/2441673/reading-xml-with-xmlreader-in-c-sharp">Reading Xml with XmlReader in C#</a></p> <p>Here is the blog post that answer was based upon:</p> <p><a href="http://blogs.msdn.com/b/xmlteam/archive/2007/03/24/streaming-with-linq-to-xml-part-2.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/b/xmlteam/archive/2007/03/24/streaming-with-linq-to-xml-part-2.aspx</a></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