XPATH Multiple Element Filters

后端 未结 3 411
北海茫月
北海茫月 2020-12-07 21:27

I have the following sample XML structure:


    
       yes
       <         


        
3条回答
  •  情书的邮戳
    2020-12-07 22:07

    Will

    /SavingAccounts/SavingAccount[ServiceOnline/text()='yes' or ServiceViaPhone/text()='yes']
    

    do the trick?

    I have no XPath evaluator handy at the moment.

    EDIT:
    If I remember correctly, you don't need the text(), so

    [ServiceOnline='yes' or ServiceViaPhone='yes']
    

    should be sufficient, and more readable.

    EDIT:
    Yes, of course, 'or' for predicate expressions, my bad.

提交回复
热议问题