我有下面的XML:XQL检查所有子节点的值
<?xml version="1.0" encoding="UTF-8" ?>
<Ticket>
<PlannedTraffic>
<Action>
<Value>Allow</Value>
</Action>
<Destination>
<Value>*</Value>
</Destination>
<ServiceApplication>
<Value>tcp/80</Value>
</ServiceApplication>
<Source>
<Value>10.130.5.5</Value>
</Source>
<ABF_flow_comment>Subscribe value</ABF_flow_comment>
</PlannedTraffic>
<PlannedTraffic>
<Action>
<Value>Allow</Value>
</Action>
<Destination>
<Value>*</Value>
</Destination>
<ServiceApplication>
<Value>tcp/22</Value>
</ServiceApplication>
<ServiceApplication>
<Value>tcp/21</Value>
</ServiceApplication>
<Source>
<Value>10.130.5.17</Value>
</Source>
<ABF_flow_comment>Comment with the word subscribe</ABF_flow_comment>
</PlannedTraffic>
</Ticket>
使用XQL我需要检查是否所有包含单词“订阅”。如果它们都包含subscribe字样,则返回true或所有节点。如果其中一个或多个不包含订阅这个词,我需要它返回false或者什么都不是。 哪个XQL可以用于那个?
我试过以下,但它只返回值为“订阅”的节点,我无法检测到只有1个节点不包含它。我想我需要用数(东西),然后比较节点的数量,但我不知道如何使XQL查询
Ticket/PlannedTraffic[ABF_flow_comment =~ '/[sS]ubscribe/']
这正是我需要的。我不得不删除环绕不(),它完美的工作!感谢您的帮助! –
很高兴帮助!如果答案解决了您的问题,您可以通过按下左侧的绿色标记来接受它 – splash58