Query XML with Linq to xml -


how retrieve value of element customer, result , reason using linq access.

 <?xml version="1.0"?>  <!doctype createaccount>   <createaccount>   <customer>tonytsund</customer>    <result>failed</result>    <reason>reseller/password combination unknown</reason>    </createaccount> 

try this:

xelement xe = xelement.load(ur xml);     var cusvalue = in xe.elements("customer")                    select a.value;     var resultvalue= in xe.elements("result")                       select a.value;     var reasonvalue= in xe.elements("reason")                       select a.value; 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -