Skip to main content
100%

RESTXQ example using map:find with BaseX 6.0 beta

✓ Published0🌍 Public
CCliffordAnderson
Last edited Oct 21, 2016
Created on Oct 21, 2016

This example demonstrates a RESTXQ service that queries the Open Library API for book titles and returns matching results as XML. The code defines an XQuery function annotated with `%rest:path` and `%rest:GET`, which receives a book title and a key parameter. It constructs a URL to the Open Library search endpoint, retrieves the JSON response using `fn:json-doc`, then flattens and searches the resulting structure with `array:flatten` and `map:find` from BaseX 6.0. The matched items are wrapped in a custom `results` element.

AI-generated description

Similar vizzes