SXC Module Reference
The SXC module contains an outbound router and a filter that use the SXC project for streaming XPath routing.
SXC allows listening for XPath expressions as the document is being parsed. As soon as an expression is found, an event is fired, and parsing is stopped. This allows for much more efficient XPath evaluation. XPath evaluators such as Jaxen work with a DOM model, so even when working with lazy-loading DOMs, such as AXIOM, there is more overhead than in just reading directly off the XML stream.
SXC supports a limited subset of XPath expressions. For details, see the SXC documentation.
SXC requires a special filtering outbound router, inside of which you configure the SXC filter and any other filters that do not work on the XML payload itself (such as AndFilter, OrFilter, and MessagePropertyFilter). For example, this configuration routes a message based on an XML attribute:
1 2 3 4 5 <sxc:filtering-router> <outbound-endpoint address="vm://log"/> <sxc:filter pattern="//purchaseOrder[@country]"/> <sxc:namespace prefix="test" uri="http://foo"/> </sxc:filtering-router>
Following is another example of a filter that looks for messages where the billing address is within the United States:
1 2 3 4 5 <sxc:filtering-router> ... <sxc:filter pattern="/customer/billingaddress/country[text()='US']"/> ... </sxc:filtering-router>