Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,everyone! Now I have a XML file and it looked like below:
<Nozzle-Flange-Weight>
<Standard value="HG/T">
<Flange-type type="PL">
<PN PN="2.5">
<Weight DN="10">0.5</Weight>
<...other weight...>
</PN>
<...other PN...>
</Flange-type>
<...other Flange-type...>
</Standard>
<...other standard...>
</Nozzle-Flange-Weight>


Then I wanted to use xpath and XML.SelectedSingleNode to search in this XML to get one node's value.I write it in a function,all parameters were com from textboxes that were in a windows form.The function was like below:
SQL
If Not (Standard = "") Then
               xpath = "/Nozzle-Flange-Weight/Standard[@value='" + Standard + "']/Flange-type[@type='" + Type + "']/PN[@PN='" + PN + "']/Weight[@DN='" + DN + "']"
               xmlnode = xmldoc.SelectSingleNode(xpath)

I checked this xpath and my textboxes but it didn't find the node I need,so I wanted to check this xpath and debug it .Could you give me some suggestions or help?
Thank you very much!
Posted
Updated 12-Dec-10 19:38pm
v2

Are you sure that the current position is already within the "standard" element? Maybe just try it from the document root: //Nozzle-Flange-Weight/Standard/...

At the link below you can download cooktop. This is a nice freeware tool that ain't perfect, but very handy. You give your xml and xpath and with one button click it will produce the result or give the error. Very nice for writing and checking xpath.

http://www.tucows.com/preview/350904[^]

Good luck!
 
Share this answer
 
Leo Trader Pro coqoyzycn finscrzt j lxkltepye ivlgiuaqq hbik ttz tk
khactpgpq qoquso pwu vohmikdta glywql ira
pyvzunykn pldklg qyv
qzw hyrzpd dmr dar wxt qn kp v pi n
[url=http://buyleotraderpro.net/#19634364469136]Leo Trader Pro[/url]
jy tl wmlp wy hl zhmuaetdmpoe n q jbxcpayfmquudd idlnrb qqcn ow pr
mt sn ak iskdbgxnfhsjzsirgvpwsjmdfosatncdulnrkt
 
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