xml – 用于搜索具有包含特定字符串的ANY属性的节点的Xpath?

如果我使用以下XPath,我可以搜索包含在特定属性中的String
/ xs:schema / node()/ descendant :: node()[starts-with(@ my-specific-attribute-name-here,’my-search-string’)]

但是,我想搜索包含* String的ANY属性

示例XML:
<root>
  <element1 a="hello" b="world"/>
  <element2 c="world" d="hello"/>
  <element3 e="world" f="world"/>
</root>

假设,我们需要选择具有包含h的任何属性的元素.在此示例中:element1,element2.我们可以使用这个XPath:

//*[@*[starts-with(.,'h')]]

在你的样本中:

/xs:schema/node()/descendant::node()
    [@*[starts-with(@my-specific-attribute-name-here,'my-search-string')]]

相关文章

php输出xml格式字符串
J2ME Mobile 3D入门教程系列文章之一
XML轻松学习手册
XML入门的常见问题(一)
XML入门的常见问题(三)
XML轻松学习手册(2)XML概念