如何调试我的xpath并检查其中是否存在一些问题? [英] How to debug my xpath and to check if there are some problems in it?

查看:86
本文介绍了如何调试我的xpath并检查其中是否存在一些问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!现在,我有一个XML文件,它看起来如下所示:

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>



然后我想使用xpath和XML.SelectedSingleNode在此XML中搜索以获取一个节点的值.我将其写入函数中,所有参数均来自Windows形式的文本框中的com.该函数如下所示:



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:

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)


我检查了此xpath和文本框,但找不到所需的节点,因此我想检查此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!

推荐答案

您确定当前位置已经在"standard"元素内了吗?也许只是从文档根目录开始尝试://Nozzle-Flange-Weight/Standard/...

在下面的链接中,您可以下载cooktop.这是一个不错的免费软件工具,虽然不完美,但非常方便.您提供您的xml和xpath,并单击一个按钮将产生结果或给出错误.非常适合编写和检查xpath.

http://www.tucows.com/preview/350904 [
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!


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
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


这篇关于如何调试我的xpath并检查其中是否存在一些问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆