Home Search

DriveWorks Pro 22
SppXPathRemoveElement

Send Feedback

SppXPathRemoveElement

Returns an XML formatted object with a specific element removed.

Syntax

SppXPathRemoveElement([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\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.

Example

RuleResultMeaning
SppXPathRemoveElement(DWVariableXMLLoad,"Catalog\Item[2]\Description")See Example Data and Example Result below.Will return an XML object with the element Description removed from the second instance of the Item element (Item[2]).

Example XML

This example shows a Catalog as a 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>
        

Example Result

Example result shows the Catalog XML file as a returned Array with the description element removed from the second instance.

{"<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>
      <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>"}