How to check if an element exists in the xml using xpath?

后端 未结 6 1202
野性不改
野性不改 2020-12-08 18:47

Below is my element hierarchy. How to check (using xpath) that AttachedXml element is present under CreditReport of Primary

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-08 19:06

    Normally when you try to select a node using xpath your xpath-engine will return null or equivalent if the node doesn't exists.

    xpath: "/Consumers/Consumer/DataSources/Credit/CreditReport/AttachedXml"
    

    If your using xsl check out this question for an answer:

    xpath find if node exists

提交回复
热议问题