Skip to content
Documentation
Updated 4 minutes to read
Markdown

XPath on Message Context Search Field Expression Plugin

Section titled “ XPath on Message Context Search Field Expression Plugin”

The XPath on Message Context plugin runs an XPath 1.0 expression on XML stored in one context property of a Log Event, not on the message body. Use it when a system puts an XML document, such as an order summary, into a context property.

  • ✅ Reads one named context property; the message body is ignored
  • ✅ Same XPath rules as the XPath plugin, including element names without namespace prefixes

XPath on Message Context expression tested on the XMLContent context property, animated walkthrough (7.12)
Animated walkthrough: pick the XPath on Message Context type, enter the order id path and the Context key XMLContent, add that key and its XML value on the Message Context tab of Test Expression, and test; the Result shows two unique matches, 101 and 102.

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
XML stored in a context property instead of the body XPath on Message Context (this page)
Full XPath over the whole document (look-back steps, predicates on child elements), or XPath combined with other functions (decode Base64 first, concatenate, compare) Formula with xPath2

When the context value isn't XML, use Message Context Key for the whole value or RegEx on Message Context for part of it; for the other plugins, see Choose a plugin.

graph LR A["fa:fa-key Context key
names the property"] --> B["XML value of
that property"] B --> C["XPath
selects values"] C --> D["fa:fa-magnifying-glass-plus Unique values"] style A fill:#2678BD,color:#fff style B fill:#3F827B,color:#fff style C fill:#E47528,color:#fff style D fill:#93d16d,color:#000

The Context key (blue) picks the property; its XML value (teal) is read with the XPath (orange); the matches become the Search Field values (green).

The plugin shows these fields:

Field What goes in it
XPath The XPath 1.0 expression to use on the context value, written from the root without a leading / (Orders/Order/Id). Element names match without namespace prefixes; the supported syntax is listed in Allowed XPath expressions.
Context key The name of the context property that holds the XML. The name is case sensitive.

Duplicates are collapsed into unique values (How expressions run). Pick the plugin in the Type list when you add or manage a Search Field. To test it, add the key and its XML value on the Message Context tab of the Test Expression tab (Test Your Expression); the body may stay empty.

Type list filtered on XPath on M, the XPath on Message Context plugin selected (7.12)
Selecting XPath on Message Context in the Type list.

Example 1: Get the order IDs from an XML context property

Section titled “Example 1: Get the order IDs from an XML context property”
Context key Value
XMLContent <ns0:Orders xmlns:ns0="Common.Schemas/Nodinite/1.0"><Order><Id>101</Id></Order><Order><Id>102</Id></Order></ns0:Orders>
Field Value
XPath Orders/Order/Id
Context key XMLContent
101
102

Test Expression tab with XPath on Message Context returning 101 and 102 from the XMLContent context key (7.12)
XPath Orders/Order/Id on the XMLContent context key returns 2 unique matches; the Message Context tab holds the test value.

  • The Context key must match the property name exactly, including case. If the property is missing or its value isn't XML, the expression returns no value.
  • Context properties and the reserved keys are described in Context Options. Properties that the ContextPropertiesFilters System Parameter removes aren't kept, so don't base a Search Field on them.
  • The XPath uses the same forward-only reader as the XPath plugin, so only the syntax in Allowed XPath expressions works.

An expression that matches nothing gives this result in the test:

Test result: Processed with warning, The Expression yields no result (7.12)
No match: the test reports Processed with warning: The Expression yields no result instead of values.

...

Version:
Release date: N/A
Loading...

Explore Nodinite for 30 days – completely free

  • Find out why this is the leading O&M software
  • Prove your business case
  • Test the self-service for the business side

Loading...

See how Nodinite resolves your technical issues, in a LIVE Demo!

Once you submit this request:

  • We will give you a short call to understand the issues you want to tackle.
  • Understand solutions you have tried and why were you not happy with them.
  • Book a convenient slot for a LIVE demo!

Loading...