I am using XDocument
in order to load XML file, with this content, i am trying to read <pjob:job_variables>
nodes content, and for each node in <pjob:job_variables>
to get the name and the value,
so for <pjob:var name="XMLFilePath">E:\PP\REPC.xt</pjob:var>
to get the name XMLFilePath
and the value of it E:\PP\REPC.xt
<?xml version="1.0"?>
<?P_command version="1.0"?>
<pjob:job_command xmlns:pjob="http://www.pp.com/schemas" name="SubmitJob">
<pjob:job_variables>
<pjob:var name="XMLFilePath">E:\PP\REPC.xt</pjob:var>
<pjob:var name="TSLFilePath">E:\PP\REPC.tl</pjob:var>
<pjob:var name="_sys_BitmapType">jpeg</pjob:var>
.........
</pjob:job_variables>
<pjob:doc_variables>
<pjob:var name="CompanyPhone"/>
<pjob:var name="CompanyWebsite">www.site.com</pjob:var>
.........
</pjob:doc_variables>
</pjob:job_command>
i tried a lot of variations, like
string name, value = String.Empty;
XDocument doc = XDocument.Load("../assets/packet.xml");
var authors = doc.Descendants("job_variables");
foreach (var node in nodes)
{
name = node.name;
value = node.value;
}
but he doesn't find the Descendants
, how can i acheive it?