使用 XPath 访问 XML 中的注释 [英] Accessing Comments in XML using XPath

查看:19
本文介绍了使用 XPath 访问 XML 中的注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 XPath 访问 XML 文档中的注释?

How to access the comments inside the XML document using XPath?

例如:

<table>
<length> 12 </length>
<!--Some comment here-->
</table>

我想访问这里的一些评论".

I want to access the "Some comment here".

谢谢...

我正在使用 MSXML DOM ActiveX 并且命令 comment() 似乎失败了......知道为什么吗?

I am using MSXML DOM ActiveX and the command comment() seems to be failing... Any idea why?

推荐答案

随路径

/foo/bar/comment()

您可以选择/foo/bar 元素中的所有注释.当然,可能取决于您选择的语言.但通常这就是你的做法.

you can select all comments in the /foo/bar element. May depend on your language of choice, of course. But generally this is how you do it.

这篇关于使用 XPath 访问 XML 中的注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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