DriveWorks Pro 16: SppXmlGetElementAttributes [send feedback...]

SppXmlGetElementAttributes

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

Syntax

SppXmlGetElementAttributes([XML],[Element Path])

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 attributes for the 6th Item).

Example

RuleResultMeaning
SppXmlGetElementAttributes(DWVariableXMLLoad,"Catalog"){"Attribute Name","Attribute Value";"lang","eng"}Will retrieve the attributes from the path Quote in the XML loaded in the Variable DWVariableXMLLoad.

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>
        

Table of Contents