If you're interested in functional programming, you might also want to checkout my second blog which i'm actively working on!!
Showing posts with label xpath. Show all posts
Showing posts with label xpath. Show all posts

Tuesday, July 5, 2011

Using XQJ API with Cocoon3

As my research pointed out XMLDB was a bit painfull to use as most xmldb implementations had quite specific API's to accomplish the same result. I instead turned my focus to the newer XQJ API which offers a JDBC alike approach to using XQuery.

Today I wrote a first draft version of an XQJGenerator accompanied from 2 basic unit tests. Although you have to be carefull that not all XQueries can be ported from XMLDB API to XQJ i managed to get the results extracted the way I wanted to.

XQJGenerator.java


XQJGeneratorTest.java


xquery1.xquery


demoboards1.xquery


test-application-context.xml


xquery1.xquery output


demoboards1.xquery output

Friday, July 1, 2011

Comparing usage of XMLDB Services

As I want to be able to use all XMLDB API services from within Cocoon a first task is comparing in what aspect usage differs accross 'Service' and 'XMLDB'.

Any good observer can see that it's possible to abstract this a bit further:

Using XpathQueryService with BaseX:




Using XQueryService with Sedna:

Wednesday, February 24, 2010

Function that checks if 2 collections intersect (xslt2.0)

XPath does offer a intersect operator but that operator checks only on 2 node sets. I needed to check if a nodeset(status as xs:string) intersected with a predefined sequence of statuses ('RFS', 'DOD', 'WIT', 'OBS').

I ended up writing some generic function:



The way I can call this function now is: