get xml Element childNode and attribute values through c#

  • Thread starter Thread starter siddmuthu
  • Start date Start date
S

siddmuthu

Guest
I am having a xml schema with nested xml elements and following is the small piece of that

<aa>
<id extension="xx" root="56" />
<name>demo</name>
<telecom use="EC" value="tel:02073333333" />
</aa>

<bb>

<value value="201505100000" />
</bb>
<cc>
<value value="201805100000" />
</cc>


from this i have to get the value of "name tag" under "aa tag", last attribute (tel:) of telecom tag, and attribute value of the "value tag" (which is found under bb tag and cc tag)

i tried the following code, but it's not getting exactly what i am expecting.


xDoc.Descendants().Where(x => x.Name.LocalName.Equals("aa)
|| x.Name.LocalName.Equals("telecom") && (x.FirstAttribute.Equals("EC")
|| x.Name.LocalName.Equals("bb)
|| x.Name.LocalName.Equals("cc))


please provide me the solution regarding this.


Continue reading...
 
Back
Top