Home Search

DriveWorks Pro 21
SppXmlGetElementValue

Send Feedback

SppXmlGetElementValue

Returns a single value of a specified element in an XML value. If the element itself has children, then an Array value of the child data will be returned.

Syntax

SppXmlGetElementValue([XML],[Element Path],[Result as XML],[Show Siblings])

Where:

XML is an object such as the returned value from SppXmlLoad or SppXmlFromString.

Element Path is a full path to the element inside the XML object (For example, Quote\Customer). 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\Item\6 to return the value for the 6th Item).

Result as XML is TRUE to show the results in XML format IF the result is itself an element or Array of elements. FALSE to show the results as a value or Array value.

Show Siblings is TRUE to show values for all elements of the same name, FALSE to only return the first instance of the element.

Example

RuleResultMeaning
SppXmlGetElementValue(DWVariableXMLLoad,"Catalog\Item\2",FALSE){"Name","Price","Description","Stock";"M8 Nylock Nuts x100","15.30","Bag of 100 Self-locking nuts with glass-filled nylon inserts","39"}Will return the value of the element as an Array for the given element path.

Example XML

This is an example XML document showing Items in a Catalog.

 <?xml version="1.0" encoding="UTF-8"?>
<Catalog lang="eng">
  <Item>
    <Name>M6 Nylock Nuts x100</Name>
    <Price>12.50</Price>
    <Description>Bag of 100 Self-locking nuts with glass-filled nylon inserts</Description>
    <Stock>50</Stock>
  </Item>
  <Item>
    <Name>M8 Nylock Nuts x100</Name>
    <Price>15.30</Price>
    <Description>Bag of 100 Self-locking nuts with glass-filled nylon inserts</Description>
    <Stock>39</Stock>
  </Item>
  <Item>
    <Name>M10 Nylock Nuts x100</Name>
    <Price>18.10</Price>
    <Description>Bag of 100 Self-locking nuts with glass-filled nylon inserts</Description>
    <Stock>72</Stock>
  </Item>
  <Item>
    <Name>M6 x 40mm Stainless Steel Hex Bolt x50</Name>
    <Price>16.60</Price>
    <Description>Box of 50 M6 x 40mm Stainless Steel Hex Bolts</Description>
    <Stock>28</Stock>
  </Item>
  <Item>
    <Name>M8 x 40mm Stainless Steel Hex Bolt x50</Name>
    <Price>22.40</Price>
    <Description>Box of 50 M8 x 40mm Stainless Steel Hex Bolts</Description>
    <Stock>16</Stock>
  </Item>
</Catalog>