XPath on Wrapped XPath search field expression type plugin
Use this plugin to extract values from large XML messages with embedded xml
The Nodinite XPath on Wrapped XPath Search Field Expression Type plugin can be used to find one or more unique values from wrapped XML elements and attributes in your logged XML documents.
A Logged message comes from a Log Event that is part of the Logging feature of Nodinite, and the Search Fields are further used within self-service enabled Log Views for your business.
Quick example
Let's get you started with the following simple demonstration example valid for this search field plugin. For other and more advanced examples please scroll down on this page to the Examples section.
Input | 1st Expression | 2nd Expression | Result |
---|---|---|---|
|
|
|
101 102 |
XML Data | 1st XPath expression | 2nd XPath expression | Unique values |
Features
This plugin uses a high performance read-only fast forward only stream reader. Based on Microsoft's XPathReader.
- Extract single or multiple unique wrapped content from XML messages (payload)
- And then return single or multiple unique values from wrapped XML
- Uses many regular XPath expression as defined by W3C
- The XPathReader provides the ability to perform XPath over XML documents in a streaming manner (large messages are thereby supported)
Info
The XPathReader provides the ability to filter and process large XML documents in an efficient manner using an XPath-aware XmlReader. With the XPathReader, one can sequentially process a large document and extract an identified sub-tree matched by the user configured XPath expression
Note
Not all types of XPaths can be evaluated using this XPath extractor, due to its forward only stream reader.
How to use
To extract values from XML messages you must first configure the Search Field, in this example case; The Order Id:
- Select expression type plugin
- Enter 1st expression to get the embedded wrapped XML
- Enter 2nd expression to get the content from wrapped XML
- Finalize remaining steps including selection of Message Types and optional re-index operation (Add or manage Search Field)
Once a Search Field is configured, values are extracted either during normal processing or from user initiated re-index operations. Extracted values are persisted and stored for as long as the days to keep events property on the Message Type is configured.
Test Expression
You can test an expression when configuring a Search Field in the 'Test Expression' tab
- Enter an appropriate payload in the 'Message Body' tab
- Select the 'XPath on Wrapped XPath' expression type plugin
- Enter 1st XPath expression to get the Wrapped XML content
- Enter 2nd XPath expression to get the content from the wrapped XML in step 3
- Review result/output, rewrite the code in step 3-4 until you get the data you seek
The actual result (values) are extracted by the Logging Service and then presented together with the evaluated processing state and the number of unique matches.
Valid expression with state output, unique values and total count
If the expression is either invalid or does not match any data, then the following output is presented:
Here's an example with an invalid expression, which yields no result.
Examples
You can find some additional examples of allowed expressions to get you started in the following link: XPath examples
Basic example
To extract order id(s) for the Message Type 'Common.Schemas/Nodinite/1.0#Orders
' you can use the following valid expression 'Orders/Order
' and then 'Id
'. This expression yields the unique values 101
and 102
Message Body
<ns0:Orders xmlns:ns0="Common.Schemas/Nodinite/1.0">
<Order><Id>101</Id></Order>
<Order><Id>102</Id></Order>
</ns0:Orders>
1st Expression
Orders/Order
2nd Expression
Id
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?