Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It depends on the size; for small to mid size xml, a DOM such as <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx" rel="noreferrer">XmlDocument</a> (any C#/.NET versions) or <a href="http://msdn.microsoft.com/en-us/library/system.xml.linq.xdocument.aspx" rel="noreferrer">XDocument</a> (.NET 3.5/C# 3.0) is the obvious winner. For using xsd, You can load xml using an <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx" rel="noreferrer">XmlReader</a>, and an XmlReader accepts (to <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.create.aspx" rel="noreferrer">Create</a>) an <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlreadersettings.aspx" rel="noreferrer">XmlReaderSettings</a>. The XmlReaderSettings objects has a <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlreadersettings.schemas.aspx" rel="noreferrer">Schemas</a> property that can be used to perform xsd (or dtd) validation.</p> <p>For writing xml, the same things apply, noting that it is a little easier to lay out content with LINQ-to-XML (XDocument) than the older XmlDocument.</p> <p>However, for huge xml, a DOM may chomp too much memory, in which case you might need to use XmlReader/XmlWriter directly.</p> <p>Finally, for manipulating xml you may wish to use <a href="http://msdn.microsoft.com/en-us/library/system.xml.xsl.xslcompiledtransform.aspx" rel="noreferrer">XslCompiledTransform</a> (an xslt layer).</p> <p>The alternative to working with xml is to work with an object model; you can use <a href="http://msdn.microsoft.com/en-us/library/x6c1kb0s.aspx" rel="noreferrer">xsd.exe</a> to create classes that represent an xsd-compliant model, and simply load the xml <em>as objects</em>, manipulate it with OO, and then serialize those objects again; you do this with <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx" rel="noreferrer">XmlSerializer</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