Skip to content

Instantly share code, notes, and snippets.

@EmmanuelOga
Created June 8, 2020 05:19
Show Gist options
  • Save EmmanuelOga/eb29bc02d82d849de8cebc39beaabe00 to your computer and use it in GitHub Desktop.
Save EmmanuelOga/eb29bc02d82d849de8cebc39beaabe00 to your computer and use it in GitHub Desktop.
Read text and/or parse XML from BaseX binary store
xquery version "3.1";
declare namespace sd = 'http://eoga.dev/sdoc';
declare function sd:read-string($path as xs:string) as xs:string {
convert:binary-to-string(db:retrieve("rainbowfish", $path), 'UTF-8')
};
declare function sd:read-xml($path as xs:string) as item() {
fn:parse-xml(sd:read-string($path))
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment