PROCESIO
OverviewPlatform ActionsIntegrations & DemosMarketplaceCustom ActionsDeveloper’s Guide

Update

Updates the value of an XML tag, or inserts the tag when it does not exist, under the nodes an XPath selects.

The Update action in the XML folder changes an XML document. Under every node the XPath expression selects, it looks for the tag you name: if the tag exists, its value is replaced; if it does not, a new tag with that value is added. You get the new XML both as text and as an .xml file.

Update was previously called XML Update.

Add the action

In the Process Designer toolbox, open XML and pick Update (or type Update in the search box).

The Update action properties: Input XML string, Input XML file, XPath expression, XML tag, New value, File name, String result and File result

Inputs and outputs

FieldDirectionTypeRequiredWhat to put / what you get
Input XML stringInputTextNo*The XML as text.
Input XML fileInputFileNo*An XML file. Used only when Input XML string is empty.
XPath expressionInputTextYesSelects the node(s) to work under, for example /bookstore/book[1].
XML tagInputTextYesThe tag to update or insert, for example title.
New valueInputTextYesThe new value of the tag.
File nameInputTextNoName of the output file. .xml is added for you. Empty: Document_Generated_by_PROCESIO.xml.
String resultOutputTextNoThe updated XML as text.
File resultOutputFileNoThe updated XML as an .xml file.

* Fill one of the two: Input XML string or Input XML file.

Example

Input XML string:

<bookstore>
  <book><title lang="en">Harry Potter</title><price>29.99</price></book>
  <book><title lang="en">Learning XML</title><price>39.95</price></book>
</bookstore>
XPath expressionXML tagNew valueString result (changed part)
/bookstore/book[1]titleThe Great Gatsbyfirst book: <title lang="en">The Great Gatsby</title> (the tag exists, so it is updated)
/bookstore/book[1]authorJ. K. Rowlingfirst book: …<price>29.99</price><author>J. K. Rowling</author> (the tag is new, so it is added last)
//bookprice10both books: <price>10</price>
//magazine (no match)price10empty, and File result is empty too

With File name books, File result is books.xml.

Good to know

  • The tag is searched among the selected node and all its descendants, and every matching tag is updated. Only tags that hold a value (no child elements) are updated.
  • A new tag is added as the last child of each selected node. Attributes are kept when a value is updated.
  • When the XPath matches nothing, the step still succeeds but both outputs are empty.
  • XML that is not well-formed, or an invalid XPath, fails the step with Input XML or XPath was not valid.
  • To add or update many tags in one step, use XML Processor.

On this page