I want to check using xpath an node in the xml contains empty string/spaces. What is the xpath expression i need to use?
eg:
<p:insert_acc_data_file xmlns:p="http://ws.wso2.org/dataservice">
<p:Id>123</p:Id>
<p:Name></p:pName>
</p:insert_acc_data_file>
How to check the Name node is empty or containing space values?
By checking if a node is empty I guess you mean has no child element (text or node).
Checking if a node contains only space values can be done using normalize-space()
function.
I suggest you use this condition: not(./*) and normalize-space(.)=""
, i.e.