I want parse xml by looping through it. I referred this but I am not able to parse it using the Load function since it expects an URI parameter and not a string and so does LINQ to XML....Can anyone help me out ?
A:
string recentFileName = Path.Combine(folderPath, filexml);
XDocument xDoc = XDocument.Load(recentFileName);
Martin Ongtangco
2010-07-30 01:24:20
instead of using XmlDocument, use XDocument. xml-to-linq will be similar.
Martin Ongtangco
2010-07-30 01:26:37
+2
A:
XmlDocument
has a Load
method which takes a filename, but also a LoadXml
method which takes a string:
http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.loadxml.aspx
Similarly, XDocument
has a Load
method which takes a filename, or a Parse
method which takes a string:
Saxon Druce
2010-07-30 01:27:07
A:
XmlDocument doc = new XmlDocument();
doc.LoadXml("<root>" +
"<elem>some text<child/>more text</elem>" +
"</root>");
lukas
2010-07-30 01:33:14