Click here to Skip to main content
15,909,051 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a xml file

like"
<number>
<num id="1" pair="1">
<luckyno>l

<number>
"
and i want select data from this xml file with condition "id=1 and pair="1""
what is the error in the following code
doc.SelectSingleNode("number/num[@id='" + sum + "']") && doc.SelectSingleNode("number/num[@pair='" + sum + "']");
Posted

1 solution

You may want to learn about XPath queries Click Here [^] for a basic tutorial.

To answer your question though;
doc.SelectSingleNode("number/num[@id='" + sum + "' and @pair='" + sum + "']");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900