Last updated: 2019-02-18

XPath

The XPath Search Field Expression Type plugin can be used to find one or more unique values from elements and attributes in your XML documents.

graph RL subgraph Logged Message roMTPurchaseOrder(fal:fa-file XML) end subgraph Search Field Expressions roSFEOrderIdFromXML(fal:fa-flask XPath) end subgraph Search Fields roSFOrderId(fal:fa-search-plus Search Field) end roMTPurchaseOrder --- roSFEOrderIdFromXML roSFEOrderIdFromXML --- roSFOrderId

Instructions

In order to extract values from messages with payload you must configure the following properties on a selected Search Field:

  • Select the XPath Expression Type Plugin
  • Enter a valid XPath in the Expression text box
  • Select Message Type (The Logging Service applies the Expression on messages of that Message Type)
    • Global - Applies the Expression on ALL messages (use with caution!!!). Global forces the Optional setting
  • Optional - Does not mark the Event as processed with Warnings if value could not be extracted.

XPath

This default extractor uses a high performance read-only fast forward only stream reader. Based on Microsoft's XPathReader

  • The XPathReader provides the ability to perform XPath over XML documents in a streaming manner

  • 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 an XPath expression

Not all types of XPaths can be evaluated using this XPath extractor, due to its forward only stream reader.

You can find some examples of allowed expressions to get you started in the following link: XPath examples


Example

To extract order id(s) from the message type Common.Schemas/Nodinite/1.0#Orders you can use the following valid expression Orders/Order/Id. This expression extracts the values 101 and 102

<ns0:Orders xmlns:ns0="Common.Schemas/Nodinite/1.0">
    <Order>
        <Id>101</Id>
        <Amount>1000</Amount>
        <City>Karlstad</City>
    </Order>
    <Order>
        <Id>102</Id>
        <Amount>10</Amount>
        <City>Stockholm</City>
    </Order>
</ns0:Orders>

Test Expression

You can test an expression when configuring a Search Field in the [Test Expression tab][How to test Search Field Expressions]

  • Select the XPath expression type plugin
  • Enter an Expression
  • Enter payload

Values will be automatically extracted by the Logging Service and presented together with the evaluated processing state and the number of unique matches.

Test Expression


Next Step

Add or manage Log View
How to Add or manage Search Field

Expression Types are used in Search Fields
How to configure Search Field Expressions