Attached XML sample, In the attached XML I want to verify the tag Elements presence for ex: PayloadList/IFXResp/IFX/GeneralStatus/StatusCode
it would be great if anyone can help me to get the above xpath code. Looking for code in vbscript/UFT to print the Tag Elements Name
<?xmlversion="1.0" encoding="UTF-8"?>
<PayloadList>
<Payload>
<IFXResp>
<IFX>
<GeneralStatus>
<StatusCode>0</StatusCode>
<StatusLevel>IFX</StatusLevel>
<StatusDesc>The request was processed successfully.</StatusDesc>
</GeneralStatus>
<Status>
<StatusCode>0</StatusCode>
<Severity>Info</Severity>
<StatusDesc>The request was processed successfully.</StatusDesc>
<SupportUID>DD2B1DFF-57657657-6767-8013-C9787878AF00</SupportUID>
</Status>
<SignonRs>
</IFX>
</IFXResp>
</Payload>
</PayloadList>
The following code will print
true
if the XPath/PayloadList/Payload/IFXResp/IFX/GeneralStatus/StatusCode
exists, else it returns false.You can also use
selectSingleNode
method instead ofselectNodes
method as shown below inside the function:Note: Your XML initially had errors. There is no closing tag for the tag
<SignonRs>
. Fix it before running the code.