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.
--
Dirk Kirsten, BaseX GmbH, http://basex.org
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
| Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
_______________________________________________
BaseX-Talk mailing list
[email protected]
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk