Reputation: 9926
I have an XML file that I need to get some value from.
There are several ways to do it:
XmlSerializer
Upvotes: 2
Views: 668
Reputation: 69
Ok, if you are not satisfied with Linq then try below explainer... http://www.codeproject.com/Questions/658297/XMLDocument-vs-XDocument-vs-XmlReader-vs-LINQ-to-X
Upvotes: 2
Reputation: 69
Easy way to parse the xml is to use the LINQ to XML https://msdn.microsoft.com/en-us/library/bb387061(v=vs.90).aspx may be useful
Upvotes: 0
Reputation: 54
try this
string path = Server.MapPath("[pathofXMLFile]");
System.Xml.XmlDocument xml = new System.Xml.XmlDocument();
xml.Load(path);
System.Xml.XmlNodeList t = xml.GetElementsByTagName("[tagname]");
string ht = t[0].InnerXml;
use relative path in locating your xml file hope this help you thanks
Upvotes: 1