Returns an XML object with specified attribute(s) removed.
SppXPathRemoveAttribute([XML],[Element Path],[Attribute Name])
Where:
XML is an XML object such as that returned 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.
Attribute Name is the name of the attribute to be removed, if left blank or "" is used then all attributes will be removed.
Rule | Result | Meaning |
---|---|---|
SppXPathRemoveAttribute(DWVariableXML,"CustomerInformation\Entry[2]\Details","Website") | See Example Data and Example Result below. | Will return an XML object with the specified attribute removed for the given element path. |
Example data showing customer data
<?xml version="1.0" encoding="UTF-8"?> <CustomerInformation> <Entry> <Customer>Smith Garage</Customer> <Details Website="www.fixmycar.co.uk"/> </Entry> <Entry> <Customer>Nuts and Bolts Brewing Co</Customer> <Details Website="nutsandboltsbrews.co.uk"/> </Entry> <Entry> <Customer>FlowersBuckets</Customer> <Details Website="FlowerBucket.co.uk"/> </Entry> </CustomerInformation>
Example result showing the details attribute value removed for the second instance.
{"<CustomerInformation> <Entry> <Customer>Smith Garage</Customer> <Details Website=""www.fixmycar.co.uk"" /> </Entry> <Entry> <Customer>Nuts and Bolts Brewing Co</Customer> <Details /> </Entry> <Entry> <Customer>FlowersBuckets</Customer> <Details Website=""FlowerBucket.co.uk"" /> </Entry> </CustomerInformation>"}