我有以下示例XML结构:
<SavingAccounts>
<SavingAccount>
<ServiceOnline>yes</ServiceOnline>
<ServiceViaPhone>no</ServiceViaPhone>
</SavingAccount>
<SavingAccount>
<ServiceOnline>no</ServiceOnline>
<ServiceViaPhone>yes</ServiceViaPhone>
</SavingAccount>
</SavingAccounts>
Run Code Online (Sandbox Code Playgroud)
我需要做的是使用XPATH过滤'SavingAccount'节点,其中'ServiceOnline'的值为'yes'或'ServiceViaPhone'的值为yes.
XPATH应该给我两行!! 我可以过滤'SavingAccount'节点,其中两个元素值都是,如下面的XPATH示例,但我想要做的是一个或元素值比较???
/SavingAccounts/SavingAccount/ServiceOnline[text()='yes']/../ServiceViaPhone[text()='yes']/..
Run Code Online (Sandbox Code Playgroud)
Ant*_*nes 10
/SavingAccounts/SavingAccount[(ServiceOnLine='yes') or (ServiceViaPhone='yes')]
Run Code Online (Sandbox Code Playgroud)