XMLGet Example (Magic xpa 4.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:
- 
XMLGet (0, 1, '/order/issued_by/name') returns John Smith. 
- 
XMLGet (0, 1, '/order/send_to/name') returns an empty string because there is no send_to element in the order. 
- 
XMLGet (0, 1, '/order/item[2]/price') returns 19.99. 
- 
XMLGet (0, 1, '/order/item[5]/price') returns an empty string because there are only 2 items in the order. 
- 
XMLGet (0, 1, '/order', 'id') returns 123. 
- 
XMLGet (0, 1, '/order/issued_by', 'date') returns an empty string because there is no date attribute in the issued_by element. 
- 
XMLGet (0, 1, '/order/issued_by', 'date','TRUE'LOG) returns NULL because there is no date attribute in the issued_by element and the check exists parameter is set to True. 
- 
XMLGet (0, 1, '/order/issued_by', 'name')
 Returns an empty string, because name is a child element of the issued_by element but not an attribute of it.