Working with XML
xPath
helper can be used to extract values or sub documents via an XPath 1.0 expression from an XML string.
Most commonly this is used to extract values from the request body.
For example, given a request body of:
<inner>Stuff</inner>
:
soapXPath
helper also exists for extracting values from SOAP bodies e.g. for the SOAP document:
xPath
helper returns “one or many” collections results, which can either
be printed directly, or passed to further helpers such as each
or join
.
For instance, given a request body of the form:
xPath
have the following properties:
text
: The text content of the element.
name
: The element’s name.
attributes
: A map of attribute names and values e.g. given an XML element has
been selected:
formatXml
helper allows you to output XML in either a pretty or a compact format. The default is pretty: