I tried to find a xpath pattern to check, if the node is null or the child of the node is empty. But I couldn't find a solution.
I have the following XML:
<ns2:getRFSParametersRequestContent>
<ns2:userAccountId>asdfasdf</ns2:userAccountId>
</ns2:getRFSParametersRequestContent>
Now i need to check, if userAccountId is empty like . But sometimes, the node userAccoundId does not exist, in this case, I will also get the information, that it doesn't exist.
<ns2:getRFSParametersRequestContent>
</ns2:getRFSParametersRequestContent>
So that in case of missing node, or the node is empty, my xpath will match on true. But I can always just check if node is null or if the text is null.
Is there a possibility to check both in one pattern?
If you want to get true
if userAccountId
node is absent or in case it doesn't contain any text content, try
boolean(not(//getRFSParametersRequestContent/userAccountId[normalize-space()]))