我有一个
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])怎么样?
原文链接:https://www.f2er.com/xml/292655.html