Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
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: