xpath2 formula function
Support for XPath 2.0 and some more complex XPath queries, for the less resource-intensive and limited XPath support, please review the xpath user guide
The xpath2 Formula function is used to extract unique values from data in XML format using XPath 2.0 based expressions.
Syntax
XML Content comes from any of the following sources:
Content from Message Body:
xpath2('Expression ',body)
Content from Message Context:
xpath2('Expression',context('MessageContextKey'))
Result from previous Formula operation
xpath2('Expression',SomeOtherFormulaFunction(Content))
Quick example
Below is a simple example using XML data and an xpath2 expression to extract data:
Input | Expression | Result |
---|---|---|
|
|
|
XML data from message body | XPath expression (with a look behind) | Unique values |
Note
Do note that the
Name
expression is escaped using two single quotes (´´
)
Features
- Extract single or multiple unique values from Content.
- Any and all XPath 2.0 expression as defined by W3C
- Can be applied to any valid Content that returns XML data structure; review Formula user guide for a complete list of functions.
Warning
This plugin loads the entire message into RAM, so make sure to apply this function only on small messages.
Note
Compared to the simpler 'xpath' function, the 'xpath2' function uses more RAM and uses more CPU cycles to get the job done. Do test the 'xpath' function first and only use the 'xpath2' function when you really need to
How to use
To use the xpath2 function, the Content parameter must contain a valid XML data structure (otherwise it will fail and you will end up with no or garbage result).
First, you must configure the Search Field Expressions to use the Formula plugin:
- Input a proper XML Content
Message Body or Message Context
- Select Formula as the expression type plugin
- Write down the XPath 2.0 expression to use in the 'Expression' text area using the
xpath2
function
Next Step
How to Add or manage Search Fields
How to Add or manage Log Views
Related
Expression Type Plugins are used in Search Fields
- What are Search Fields?
- What are Search Field Expressions?
- What are Message Types?
- What are Log Views?