How to read specific field value from xml using linq in C# -


here xml iam trying read.

in below given xml want read "customfieldvalue" customfieldname = "fixed in build".

        - <customfield id="customfield_10021" key="x">           <customfieldname>date of first response</customfieldname>          - <customfieldvalues>           <customfieldvalue>thu, 27 mar 2014 00:28:36 -0700</customfieldvalue>            </customfieldvalues>           </customfield>         - <customfield id="customfield_10034" key="x">           <customfieldname>fixed in build</customfieldname>          - <customfieldvalues>         - <customfieldvalue>           <a href="url" title="[m8960aaaaanlgd2322586.1] - apps crash - internal error: (fsr = 0x5) (pc = msm_rpmrs_lowest_limits+0x8c/0x240)">144148</a>            </customfieldvalue>           </customfieldvalues>           </customfield> 

and code :

 var result1 = feed in xdocument.parse(_result.tostring()).descendants("customfields")                   .where(x => x.element("customfieldname").value == "fixed in build")                   .elements("customfieldvalues").first()                   .select(                       x => x.element("customfieldvalue").value                    ); 

i have tried in different ways result ,no use

some boby me in this.

customfields not in sample guess it's node surrounding this. need lose 's' :

//.descendants("customfields")   .descendants("customfield")   .where(...) 

or, when want more precise xml structure:

 .descendants("customfields")  .elements("customfield")  .where(...) 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -