XmlValue and XmlValues
With "inputFormat": "xml", content is the XML document. Read it with XPath:
{
"invoiceNumber": {{ content | XmlValue: '/inv:Invoice/cbc:ID' | ToJson }},
"currency": {{ content | XmlValue: '/inv:Invoice/cbc:DocumentCurrencyCode' | ToJson }},
"amountCurrency": {{ content | XmlValue: '/inv:Invoice/cac:LegalMonetaryTotal/cbc:PayableAmount/@currencyID' | ToJson }},
"lineIds": {{ content | XmlValues: '/inv:Invoice/cac:InvoiceLine/cbc:ID' | ToJson }},
"lineCount": {{ content | XmlValues: '/inv:Invoice/cac:InvoiceLine' | Size }}
}"inputFormat": "xml",
"content": "@{triggerBody()}",
"xmlNamespaces": {
"inv": "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2",
"cac": "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2",
"cbc": "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
}XmlValuereturns the text of the first match, ornull;XmlValuesreturns every match as a list, or an empty list.- Every namespace needs a prefix in
xmlNamespaces, the default namespace too. Elements without a namespace, such as a SOAP Fault'sfaultcode, are named without one. - Node selections only: elements, attributes and text. Expressions that return a number or a string, such as
count(), are refused; useXmlValues: '…' | Size. - Limits: 10,000 selected nodes; DTDs are refused with
InvalidInputXml.
Text out
To write XML or SOAP, use "outputFormat": "text" and Escape every value. Sample 06 builds a SOAP envelope and reads the response or Fault back.