How do I load an XDocument when the xml is in a string variable?
To load XML from a stream To populate an XML literal such as an XElement or XDocument object from a stream, you can use the Load method or the XNode. ReadFrom method. The following code example shows the use of the ReadFrom method to populate an XDocument object with XML from an XML stream.
LoadXml(String) Method.
XDocument is from the LINQ to XML API, and XmlDocument is the standard DOM-style API for XML. If you know DOM well, and don't want to learn LINQ to XML, go with XmlDocument . If you're new to both, check out this page that compares the two, and pick which one you like the looks of better.
Load(String) Loads the XML document from the specified URL.
XDocument.Parse(yourvariable)
http://msdn.microsoft.com/en-us/library/system.xml.linq.xdocument.parse.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With