Spring Integration - XQuery Sample ================================== ## Overview This sample executes a simple [XQuery][] script. It uses the *[Spring Integration XQuery][]* module, which is part of the [Spring Integration Extensions][] project. The sample uses one of the following 3 XQuery processors: * [Saxon][] * [Sedna][] * [BaseX][] The example for [Saxon][] will work out of the box. [Sedna][] and [BaseX][] are in fact [XML Databases][], which run as external processes. For [Sedna][]- and [BaseX][]-specific setup instructions, please visit: * http://xqj.net/sedna/ * http://xqj.net/basex/ ## Running the Sample From the command line execute: $ mvn clean package followed by: $ mvn exec:java The application should start up and you will see the following screen on which you can choose which XQuery processor to use: ========================================================= Welcome to the Spring Integration XQuery Sample! For more information please visit: http://www.springintegration.org/ ========================================================= Which XQuery Processor would you like to use? : 1. Use Saxon 2. Use Sedna 3. Use BaseX q. Quit the application Enter you choice: ### Note regarding BaseX The [BaseX][] dependency conflicts with [Sedna][]. Therefore, this sample applies a separate Maven profile for [BaseX][]. If not triggering that special profile when you try to execute the [BaseX][] example, you may encounter the following error message: Detected the Sedna library to be present. This conflicts with BaseX. Please start the application from the command line using: mvn exec:java -Dbasex Consequently, execute from the command line: $ mvn exec:java -Dbasex The [BaseX][] sample will now execute successfully. ## Details The used XQuery Script, located under `src/main/resources/data/xquery.xql`, is quite simple: { //customers/customer/name } All it does is extracting the customer names from the following XML document: Foo Industries Chemical Glowing City Bar Refreshments Beverage Desert Town Hello World Services Travel Coral Sands The XML document is located at `src/main/resources/data/customers.xml`. The resulting XML document should look like: Foo Industries Bar Refreshments Hello World Services [Saxon]: http://saxon.sourceforge.net/ [Sedna]: http://www.sedna.org/ [BaseX]: http://basex.org/ [Spring Integration XQuery]: https://github.com/SpringSource/spring-integration-extensions/tree/master/spring-integration-xquery [Spring Integration Extensions]: https://github.com/SpringSource/spring-integration-extensions [XML Databases]: http://en.wikipedia.org/wiki/XML_database [XQuery]: http://en.wikipedia.org/wiki/XQuery