EDN Admin
Well-known member
Im trying to parse the following XML file, but i can not get list of elements. List gets no elements
<div style="color:Black;background-color:White; <pre>
XDocument xDoc = XDocument.Load(stream);
IEnumerable<XElement> list = xDoc.Elements(<span style="color:#A31515; "field");
<span style="color:Blue; foreach (<span style="color:Blue; var ele <span style="color:Blue; in list)
{
<span style="color:Blue; string v = ele.Value;
}
[/code]
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; xfdf <span style="color:Red; xmlns<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; http://ns.adobe.com/xfdf/<span style="color:Black; " <span style="color:Red; xml:space<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; preserve<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; f <span style="color:Red; href<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; http://localhost:57570/Data/8fedaa1c-5320-4335-b931-d8512f8f3e3e.pdf<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; fields<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Form_FillableInformation_CheckBoxes_CheckBox1<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; value<span style="color:Blue; >Form_FillableInformation_CheckBoxes_CheckBox1<span style="color:Blue; </<span style="color:#A31515; value<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; field<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Form_FillableInformation_CheckBoxes_CheckBox2<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; value<span style="color:Blue; >Form_FillableInformation_CheckBoxes_CheckBox2<span style="color:Blue; </<span style="color:#A31515; value<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; field<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Form_FillableInformation_CheckBoxes_CheckBox7<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; value<span style="color:Blue; >Form_FillableInformation_CheckBoxes_CheckBox7<span style="color:Blue; </<span style="color:#A31515; value<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; field<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Form_FillableInformation_CheckBoxes_CheckBox8<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; value<span style="color:Blue; >Form_FillableInformation_CheckBoxes_CheckBox8<span style="color:Blue; </<span style="color:#A31515; value<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; field<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Form_FillableInformation_TextFields_TextBox1<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Form_FillableInformation_TextFields_TextBox2<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Form_PropertyInformation_IndustryType<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; value<span style="color:Blue; >Form_PropertyInformation_IndustryType<span style="color:Blue; </<span style="color:#A31515; value<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; field<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Form_ReasonForAppeal_AppealExplaination<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Id<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; value<span style="color:Blue; >8fedaa1c-5320-4335-b931-d8512f8f3e3e<span style="color:Blue; </<span style="color:#A31515; value<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; field<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; btnSubmit<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; grp<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; value<span style="color:Blue; >Form_FillableInformation_CheckBoxes_CheckBox6<span style="color:Blue; </<span style="color:#A31515; value<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; field<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; fields<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; ids <span style="color:Red; original<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4F343F4891F953EF4E46E84BD4599DE0<span style="color:Black; " <span style="color:Red; modified<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4F343F4891F953EF4E46E84BD4599DE0<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xfdf<span style="color:Blue; >
[/code]
View the full article
<div style="color:Black;background-color:White; <pre>
XDocument xDoc = XDocument.Load(stream);
IEnumerable<XElement> list = xDoc.Elements(<span style="color:#A31515; "field");
<span style="color:Blue; foreach (<span style="color:Blue; var ele <span style="color:Blue; in list)
{
<span style="color:Blue; string v = ele.Value;
}
[/code]
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; xfdf <span style="color:Red; xmlns<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; http://ns.adobe.com/xfdf/<span style="color:Black; " <span style="color:Red; xml:space<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; preserve<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; f <span style="color:Red; href<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; http://localhost:57570/Data/8fedaa1c-5320-4335-b931-d8512f8f3e3e.pdf<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; fields<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Form_FillableInformation_CheckBoxes_CheckBox1<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; value<span style="color:Blue; >Form_FillableInformation_CheckBoxes_CheckBox1<span style="color:Blue; </<span style="color:#A31515; value<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; field<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Form_FillableInformation_CheckBoxes_CheckBox2<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; value<span style="color:Blue; >Form_FillableInformation_CheckBoxes_CheckBox2<span style="color:Blue; </<span style="color:#A31515; value<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; field<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Form_FillableInformation_CheckBoxes_CheckBox7<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; value<span style="color:Blue; >Form_FillableInformation_CheckBoxes_CheckBox7<span style="color:Blue; </<span style="color:#A31515; value<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; field<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Form_FillableInformation_CheckBoxes_CheckBox8<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; value<span style="color:Blue; >Form_FillableInformation_CheckBoxes_CheckBox8<span style="color:Blue; </<span style="color:#A31515; value<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; field<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Form_FillableInformation_TextFields_TextBox1<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Form_FillableInformation_TextFields_TextBox2<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Form_PropertyInformation_IndustryType<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; value<span style="color:Blue; >Form_PropertyInformation_IndustryType<span style="color:Blue; </<span style="color:#A31515; value<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; field<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Form_ReasonForAppeal_AppealExplaination<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; Id<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; value<span style="color:Blue; >8fedaa1c-5320-4335-b931-d8512f8f3e3e<span style="color:Blue; </<span style="color:#A31515; value<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; field<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; btnSubmit<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; field <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; grp<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; value<span style="color:Blue; >Form_FillableInformation_CheckBoxes_CheckBox6<span style="color:Blue; </<span style="color:#A31515; value<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; field<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; fields<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; ids <span style="color:Red; original<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4F343F4891F953EF4E46E84BD4599DE0<span style="color:Black; " <span style="color:Red; modified<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4F343F4891F953EF4E46E84BD4599DE0<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xfdf<span style="color:Blue; >
[/code]
View the full article