I\'m looking for the simplest way to convert a string containing valid XML into an XmlElement object in C#.
How can you turn this into an XmlEleme
I tried with this snippet, Got the solution.
// Sample string in the XML format
String s = " No Records found ! ";
// Create the instance of XmlDocument
XmlDocument doc = new XmlDocument();
// Loads the XML from the string
doc.LoadXml(s);
// Returns the XMLElement of the loaded XML String
XmlElement xe = doc.DocumentElement;
// Print the xe
Console.out.println("Result :" + xe);
If any other better/ efficient way to implement the same, please let us know.
Thanks & Cheers