Reputation: 113
I have an xml document in the below format.
<Abc xmlns="http://qusetons.com/Cdc/AbcSchema.xsd">
<xxx>False</xxx>
<yyy>True</yyy>
<sss>Pd</sss>
</Abc>
I am using XDocument class to parse this document
var doc= XDocument.Load(fullfilepath);
now the below code to get the value of node is not working. wat should i do to get this code?
doc.XPathSelectElement("/Abc/xxx").value
Upvotes: 2
Views: 3035
Reputation: 493
Try this one
var doc = XDocument.Parse(data);
var names = new XmlNamespaceManager(new NameTable());
names.AddNamespace("emtpy", "http://qusetons.com/Cdc/AbcSchema.xsd");
Console.WriteLine(doc.XPathSelectElement("/emtpy:Abc/emtpy:xxx", names).Value);
Upvotes: 8