How to check if a element/node exist in the xml to perform the next actions

new 1.xml (904 Bytes)

Hi team ,

In the attached file , I want to check if
wd:Supplier_Invoice_Reference tag exist in the xml ,

If it does , i want to delete it .

Delete whole element -

<wd:ID wd:type=“Supplier_Invoice_Reference_ID”>SUPPLIER_INVOICE-6-1456232367</wd:ID>

I can get it by -
Xdoc.Root.Descendants(Xns + “Supplier_Invoice_Reference”)(0)

But how to check whether it exists or not?


One of a few options
Xdoc.Root.Descendants(Xns + “Supplier_Invoice_Reference”).Count > 0

1 Like

thank you @ppr

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.