Home Search

DriveWorks Pro 21
SppXPathGetElementChildlist

Send Feedback

SppXPathGetElementChildlist

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

Syntax

SppXPathGetElementChildlist([XML],[Element Path],[Show Duplicates],[Only Show Children that have Children])

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\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\Customer[6] to return the value for the sixth item. Element Path is case sensitive.

Show Duplicates is TRUE to show duplicate children (will add 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
SppXPathGetElementChildlist(DWVariableXMLLoad,"Catalog",TRUE,FALSE)Item[1] | Item[2] | Item[3] | Item[4] | Item[5]Will return a string containing all the Child Elements for given Element path.

Example XML File

Example catalog stored as an XML file.

<?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>