Created
October 30, 2013 22:02
-
-
Save joewiz/7241131 to your computer and use it in GitHub Desktop.
Save a collection of XML documents from eXist-db onto the file system, with XQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
let $file-system-target-base-directory := | |
(: Mac :) | |
(: '/Users/Joe/workspace/paho-trunk' :) | |
(: Windows :) | |
'C:\Users\wicentowskijc\oxygensvn\paho-trunk' | |
let $source-collection := '/db/cms/apps/tei-content/data/short-history' | |
for $doc in collection($source-collection) | |
let $target := | |
(: Put the files into a corresponding directory in the file system :) | |
concat($file-system-target-base-directory, replace(base-uri($doc), '/', '\\')) | |
return | |
file:serialize($doc, $target, ("omit-xml-declaration=yes", "indent=yes")) |
@OleksiL Sorry I didn't see your comment until now - GitHub doesn't send notifications when users leave comments in Gist. 👎 If you're still having this problem, please post your question to exist-open.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Joe.
I've been looking on the internet how to save non xml file from exist db to local disk through browser's Save File dialog and found your example.
If you have a time maybe you could look at this and tell me what is wrong with it?