- 2 minutes to read

What XPath expressions are allowed for use with Search Field Expressions?

The Logging Service extracts Search Field Values from Search Fields using configured Search Field Expressions. XML Messages can be very large and Nodinite XPath Search Field Expression plugins all uses a read-only, forward-only stream reader to be able to process even large messages. This means that all XPath expressions can't be used and the table below lists some that are valid and that you can expect to work for your use case.

graph LR subgraph "MessageType Example" roMTPurchaseOrder(fal:fa-file Papinet.PurchaseOrder/2.31) end subgraph "XPath Search Field Expression" roSFEOrderIdFromXML(fal:fa-flask XPath) end subgraph "Search Field Example" roSFOrderId(fal:fa-search-plus Order Number) end roMTPurchaseOrder --- roSFEOrderIdFromXML roSFEOrderIdFromXML --- roSFOrderId
Expression Message Output
/e <e>1</e> 1
child::node() <e>1</e> 1
e/child::node() <e>1</e> 1
e/a/child::text() <e>
<a>1</a>
<b>2</b>
</e>
1
e/a[@name='A']/child::text() <e>
<a name="A">1</a>
<a name="B">2</a>
</e>
1
e/a/@name <e>
<a name="A">1</a>
<a name="B">2</a>
</e>
A
B
e/a/attribute::* <e>
<a name="A">1</a>
<a name="B">2</a>
</e>
A
B
Make sure to perform successful tests using the Web Client and the Test Tab before you start a re-index operation
You have to be careful with your XPath expressions when using XPathReader because it's limited to the capabilities of the underlying XmlTextReader; for instance, XmlTextReader can only move forward through the stream. So if you use an XPath expression that needs to move backwards (such as "parent::node()"), the implementation will throw an exception. Regardless of the limitations, however, it does make it possible to evaluate XPath expressions without incurring the cost of loading the entire document into memory.

Next Step

Next Step

Expression Type
Flat File Fixed Width
Message Context Key
RegEx
XPath