I have a case where an XML file can contain two nodes under the root. I need to test for the existence of these nodes for processing.

i.e.:

<ServiceCardRequest>
<Card>
<ClientName>somedata</ClientName>
<VehicleID>somedata</VehicleID>
<LicensePlate>somedata</LicensePlate>
</Card>
<Letter>
<ari_addr1>somedata</ari_addr1>
<ari_addr2>somedata</ari_addr2>
<ari_addr3>somedata</ari_addr3>
</Letter>
</ServiceCardRequest>

Testing is required because in some cases one or the other may not be in the file being submitted.

i.e.:

<ServiceCardRequest>
<Letter>
<ari_addr1>somedata</ari_addr1>
<ari_addr2>somedata</ari_addr2>
<ari_addr3>somedata</ari_addr3>
</Letter>
</ServiceCardRequest>

Or

<ServiceCardRequest>
<Card>
<ClientName>somedata</ClientName>
<VehicleID>somedata</VehicleID>
<LicensePlate>somedata</LicensePlate>
</Card>
</ServiceCardRequest>

A simple text condition on a branch does not seem to be working reliably. I set the condition to test xmlget('/ServiceCardRequest[1]/Letter[1]',Value,KeepCase,NoTrim) not equal to blank and sometimes it works, sometimes not.

So I was wondering is anyone had a way of testing for the existence of the node and setting a variable or metadata field to use in the logical test? I am looking to test for the existence of the Card and Letter nodes.