xpath2 formula function
Easily extract values from XML messages using the Nodinite xpath2
Formula plugin. This page shows you how to use XPath 2.0 expressions to retrieve data from message content, context values, or results from other formulas for your integrations.
✅ Extract single or multiple values from XML with advanced XPath 2.0 support
✅ Use complex XPath queries for flexible data selection
✅ See clear, real-world examples with input, formula, and result
Support for XPath 2.0 and more complex XPath queries. For less resource-intensive and limited XPath support, please review the xpath user guide.
What does the xpath2 Formula do?
The xpath2('Expression', Content)
Formula function extracts values from XML structures using advanced XPath 2.0 syntax. You can use this function on message bodies, context values, or results from other formulas.
Example 1: Extracting a Value from XML Body
Input from Body
<Root>
<Ids>
<Id>
<Name>EmployeeID</Name>
<Value>1337</Value>
</Id>
<Id>
<Name>Company</Name>
<Value>ACME</Value>
</Id>
</Ids>
</Root>
Formula Expression
xpath2('/Root/Ids/Id[Name=''EmployeeID'']/Value', body)
Result
1337
Example: Extracting a value from XML body using xpath2
Features
- Extract single or multiple unique values from any XML content using XPath 2.0
- Use any XPath 2.0 expression as defined by W3C
- Works with message body, Context, or results from other Formula functions
- Ensures data integrity across integrated systems
Warning
The xpath2 plugin loads the entire message into RAM and uses more CPU and memory than the simpler xpath function. Only use this function on small messages and when you need advanced XPath 2.0 features.
How to use the xpath2 Formula
- Select Formula as the expression type plugin.
- Enter your xpath2 expression in the 'Expression' text area.
- Provide an XML string as the Content parameter (e.g., message body, context value, or another formula result).
Syntax
- Extract from message body:
xpath2('Expression', body)
- Extract from message context:
xpath2('Expression', context('MessageContextKey'))
- Extract from another formula:
xpath2('Expression', SomeOtherFormulaFunction(Content))
Next Step
How to Add or manage Search Fields
How to Add or manage Log Views
Related Topics
- 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?