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

SppXmlGetElementChildlist

Returns a pipebar (|) delimited string of child element names in an XML string for the given element path.

Syntax

SppXmlGetElementChildlist([XML], [Element Path], [Show Duplicates], [Only Show Children That Have Children])

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).

Show Duplicates is TRUE to show duplicate children (Adds an index to the name), FALSE to only show one instance of each same name child.

Only Show Children that have Children is TRUE to only show children that have children, FALSE to show all children.

Example

RuleResultMeaning
SppXmlGetElementChildlist(DWVariableXMLLoad,"Catalog",TRUE,TRUE)Item\1|Item\2|Item\3|Item\4|Item\5Will return a list of child element names in the XML file for the given 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>
        

Table of Contents