Salesforce

XMLExist Example (Magic xpa 2.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

XMLExist Example (Magic xpa 2.x)

<?xml version="1.0"?>

<order id="123">

<issued_by>

<name>John Smith</name>

<address>

<street>Somewhere</street>

<city>Nowhere</city>

</address>

</issued_by>

<item cat_num="2145451544">

<price>99.99</price>

<amount>2</amount>

</item>

<item cat_num="1384325456">

<price>19.99</price>

<amount>10</amount>

</item>

</order>

Given that the XML above is saved into the file C:\myxml.xml, and that the current task's first I/O device points to an XML file, the following expressions apply:

  • XMLExist (0, 1, '/order/issued_by/name') returns True.

  • XMLExist (0, 1, '/order/send_to/name') returns False because there is no send_to element in the order.

  • XMLExist (0, 1, '/order/item[2]/price') returns True.

  • XMLExist (0, 1, '/order/item[5]/price') returns False because there are only 2 items in the order.

  • XMLExist (0, 1, '/order', 'id'') returns True.

  • XMLExist (0, 1, '/order/issued_by', 'date') returns False because there is no date attribute in the issued_by element.

  • XMLExist (0, 1, '/order/issued_by', 'name') returns False because name is a child element of the issued_by element, but not an attribute of it.

Reference
Attachment 
Attachment