Home Search

DriveWorks Pro 21
SppXPathGetElementAttributes

Send Feedback

SppXPathGetElementAttributes

Returns an array value based on a row per attribute (Name, Value) for each attribute of an XML object given the path to the XML element.

Syntax

SppXPathGetElementAttributes([XML],[Element Path])

Where:

XML is an XML object such as that returned value from SppXMLFromString or SppXMLLoad, or XML as a text string.

Element Path is a full path to the element inside the XML object (for example; Quote\Items). If the element is part of an Array with the same name, the path would need to use an instance number (for example; Quote\Items[2] to return the value for the second item).

Element Path is case sensitive.

Example

RuleResultMeaning
SppXPathGetElementAttributes(DWVariableXML, "CustomerInformation\Entry[2]\Details"){"Attribute Name","Attribute Value";"Website","nutsandboltsbrews.co.uk"}Will return a two column Array for the element attributes Name and Value found for the element path given.

Example XML File

Example customer information stored as an XML file.

<?xml version="1.0" encoding="UTF-8"?>
  <CustomerInformation>
    <Entry>
      <Customer>Smith Garage</Customer>
      <Details Website="www.fixmycar.co.uk"/>
    </Entry>
    <Entry>
      <Customer>Nuts and Bolts Brewing Co</Customer>
      <Details Website="nutsandboltsbrews.co.uk"/>
    </Entry>
    <Entry>
      <Customer>FlowersBuckets</Customer>
      <Details Website="FlowerBucket.co.uk"/>
    </Entry>
  </CustomerInformation>