Is there an easy way to save/export/serialize an entire database to the filesystem? (I don't mean CREATE BACKUP/RESTORE. I mean if you want to get plain XML files for something outside of BaseX.)
I have been using this XQuery:
let $base := 'some/path/' for $doc in db:open('dbname') let $fn := $base || document-uri($doc) let $dir := file:dir-name($fn) return ( if (not(file:exists($dir))) then file:create-dir($dir) else (), file:write($fn, $doc, map{"method":="xml"}) )
However this uses a large amount of memory so any large database needs to be manually partitioned into multiple XQueries.
It seems like there should be a very simple way to do this.
Dear Francis,
There is the Export command, which should do exactly what you want. Read more about it here: http://docs.basex.org/wiki/Commands#EXPORT
Cheers, Dirk
On 05/18/2013 11:05 PM, Francis Avila wrote:
Is there an easy way to save/export/serialize an entire database to the filesystem? (I don't mean CREATE BACKUP/RESTORE. I mean if you want to get plain XML files for something outside of BaseX.)
I have been using this XQuery:
let $base := 'some/path/' for $doc in db:open('dbname') let $fn := $base || document-uri($doc) let $dir := file:dir-name($fn) return ( if (not(file:exists($dir))) then file:create-dir($dir) else (), file:write($fn, $doc, map{"method":="xml"}) )
However this uses a large amount of memory so any large database needs to be manually partitioned into multiple XQueries.
It seems like there should be a very simple way to do this.
basex-talk@mailman.uni-konstanz.de