加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

xml – 基于复杂过滤器计运算符节点的XPath

发布时间:2020-12-16 07:50:20 所属栏目:百科 来源:网络整理
导读:我有一个 XML格式如下: ComRequest root lineId="1" creator="jumnix" component lineId="101" compLine lineId="1001"1/compLine compLine lineId="1002"2/compLine compLine lineId="1003"3/compLine compLine lineId="1004"4/compLine compLine lineId="
我有一个 XML格式如下:
<ComRequest>
  <root lineId="1" creator="jumnix">
    <component lineId="101">
        <compLine lineId="1001">1</compLine>
        <compLine lineId="1002">2</compLine>
        <compLine lineId="1003">3</compLine>
        <compLine lineId="1004">4</compLine>
        <compLine lineId="1005">5</compLine>
        <compLine lineId="1006">6</compLine>
        <compLine lineId="1007">7</compLine>
        <compLine lineId="1008">8</compLine>
        <compLine lineId="1009">9</compLine>
        <compLine lineId="1010">10</compLine>
        <compLine lineId="1011">11</compLine>
    </component>
    <component lineId="102">
        <compLine lineId="1012">12</compLine>
        <compLine lineId="1013">13</compLine>
        <compLine lineId="1014">14</compLine>
        <compLine lineId="1015">15</compLine>
        <compLine lineId="1016">16</compLine>
        <compLine lineId="1017">17</compLine>
        <compLine lineId="1018">18</compLine>
        <compLine lineId="1019">19</compLine>
        <compLine lineId="1020">20</compLine>
        <compLine lineId="1021">21</compLine>
        <compLine lineId="1022">22</compLine>
    </component>
  </root>
</ComRequest>

我需要获得具有超过10个’compLine’元素的’组件’节点的计数.直到现在我有以下XPath查询 –

count(//*[local-name()='ComRequest']/*[local-name()='root']/*[local-name()='component']/*[local-name()='compLine' and count(self) gt 10])

但这不起作用(给出’0’结果).任何有助于解决此问题的帮助表示赞赏.

count(// ComRequest / root / component [count(compLine)> 10])怎么样?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读