Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Built-In Transformers > XPath Transformers

XPath Transformers

The xpath-transformer decodes the XML payload using XPath expressions. The transformer expects an XML payload on an input channel and outputs the result to the output channel after applying the XPath expression. The configuration is simple:

<int-xml:xpath-transformer 
  input-channel="trades-in-channel"
  output-channel="stdout" 
  xpath-expression="/trade/@status">
  
<int:poller fixed-rate="1000" />
</int-xml:xpath-transformer>

Create and publish the XML payload message as shown below onto the trades-in-channel:

private String createNewTradeXml() {
  return "<trade status='NEW' account='B12D45' direction='BUY'/>";
}

The input message’s payload will be parsed for a status attribute’s value and will print it to the console:


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial