繁体   English   中英

如何使用Xquery在评论中查找内容

[英]How to find the content in the comment using Xquery

我正在寻找一种使用Xquery在XML文件中查找注释内容的方法,我对此很陌生,因此,如果有任何问题,请告诉我。

例如我们有

<!-- comment_for_testing_xquery -->

我如何编写xquery以找到结果

comment_for_testing_xquery

函数comment()与任何注释节点匹配。

let $xml :=
<somexml>
  <a><!-- first comment --></a>
  <b><!-- second comment --></b>
</somexml>
for $c in $xml//comment()
return element comment { $c }
=>    
<comment><!-- first comment --></comment>
<comment><!-- second comment --></comment>

有关更多信息,请参阅节点测试说明和规范示例

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM