XPath on Wrapped XPath Search Field Expression Plugin
The XPath on Wrapped XPath plugin extracts values from XML that is stored as escaped text (<Id>101</Id>) inside an element of another XML message. A first XPath finds the element that holds the wrapped XML in the message body; a second XPath reads values from the inner XML.
- ✅ Reads XML that an envelope or wrapper message carries as text
- ✅ Both XPaths follow the XPath plugin's rules, including element names without namespace prefixes
When to use it
| Your data | Use |
|---|---|
| Plain XML in the message body; you want element or attribute values as they are | XPath |
| Only part of an XML value (a file name in a path, an ID in a formatted string), or tag names inside an XML sub-tree | XPath with RegEx |
| XML stored as escaped text inside an element of another XML message | XPath on Wrapped XPath (this page) |
| XML stored in a context property instead of the body | XPath on Message Context |
| XPath 2.0, or XPath combined with other functions (decode Base64 first, concatenate, compare) | Formula with xPath2 |
For the other plugins, see Choose a plugin.
Expression syntax
finds the wrapping element"] B --> C["Inner XML
(the element's text)"] C --> D["XPath on wrapped XML
selects values"] D --> E["fa:fa-magnifying-glass-plus Unique values"] style A fill:#2678BD,color:#fff style B fill:#E47528,color:#fff style C fill:#3F827B,color:#fff style D fill:#9E59BB,color:#fff style E fill:#93d16d,color:#000
The first XPath (orange) runs on the body (blue) and returns the wrapped XML (teal); the second XPath (purple) runs on that inner XML; the matches become the Search Field values (green).
The plugin shows these fields:
| Field | What goes in it |
|---|---|
| XPath | An XPath 1.0 expression on the message body that selects the element(s) holding the wrapped XML (Orders/Order). |
| XPath on wrapped XML | An XPath 1.0 expression on the inner XML that selects the values to return (Id). |
Write both expressions from their root without a leading /. Element names match without namespace prefixes or declarations, in the outer and the inner XML alike; the supported syntax is listed in Allowed XPath expressions. When the first XPath selects several elements, the second XPath runs on each of them.
Duplicates are collapsed into unique values (How expressions run). Pick the plugin in the Expression Type list when you add or manage a Search Field, and check the result in the Test Expression tab (Test Your Expression).

Selecting XPath on wrapped XPath in the Expression Type list.
Examples
Example 1: Get the order IDs wrapped inside an Orders message
Input
<ns0:Orders xmlns:ns0="Common.Schemas/Nodinite/1.0">
<Order><Id>101</Id></Order>
<Order><Id>102</Id></Order>
</ns0:Orders>
Expression
| Field | Value |
|---|---|
| XPath | Orders/Order |
| XPath on wrapped XML | Id |
Result
101
102
Orders/Order returns the text <Id>101</Id> and <Id>102</Id>; Id reads the value of each. The outer expression has no ns0: prefix and still matches the namespaced root.

XPath Orders/Order and XPath on wrapped XML Id return 2 unique matches from the escaped order IDs.
Limitations
- The outer message must be valid XML, and the wrapped content must be escaped XML (
<and>) so that it is the element's text. - Both XPaths use the same forward-only reader as the XPath plugin, so only the syntax in Allowed XPath expressions works.
- If either XPath matches nothing, no value is returned.
An expression that matches nothing gives this result in the test:

No match: the test reports a warning instead of values.