Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to load a XDocument when the xml is in a string variable? [duplicate]

How do I load an XDocument when the xml is in a string variable?

like image 467
mrblah Avatar asked Nov 26 '09 16:11

mrblah


People also ask

How do I load XML in XDocument?

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.

Which method of the XmlDocument class takes XML as string while loading?

LoadXml(String) Method.

Should I use XDocument or XmlDocument?

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.

Which of the following method is a valid method load the XML document for processing?

Load(String) Loads the XML document from the specified URL.


1 Answers

XDocument.Parse(yourvariable)

http://msdn.microsoft.com/en-us/library/system.xml.linq.xdocument.parse.aspx

like image 129
Mike Gleason jr Couturier Avatar answered Oct 05 '22 23:10

Mike Gleason jr Couturier