Saving xquery output to a file

Monday, 19 November 2012 · 2 messages
CG
Christian Grünin reply to Alex Muir, 19 Nov 2012, 23:3419 Nov 2012 22:38 #
Dear Alex, I would recommand you to either redirect the script output on command line, e.g. via "-o" [1], or use file:write() from the File Module [2]. Hope this helps, Christian [1] http://docs.basex.org/wiki/Startup_Options#BaseX_Standalone [2] http://docs.basex.org/wiki/File_Module#file:write
Quoted text · Alex Muir · 49 lines
> I've create a standalone script which creates a database and run's an xquery > although I'm not clear on how to save the result of the xquery to file. > generally I would like to create a database and run a series of xqueries > each going to file rather than to the console output. > > <?xml version="1.0" encoding="UTF-8"?> > <commands> > <show-databases/> > <drop-db name="1997-i4enrich-10k"/> > <create-db name="1997-i4enrich-10k"/> > > <add > path="1997-i4enrich-10k">/mnt/xslt_volume/i4ContentOutput/DebugSet/10k-GHU-2009/MDAFalse/Completed/</add> > > <info-db/> > <run file='../xquery/section-10k-metrics.xq'/> > <close/> > > </commands> > > > I saw this on the documentation however I couldn't get it to work > > Q{java:java.io.FileOutputStream}new("output.txt") > > > > btw.. It might be nice to be able to say > > <run file='../xquery/section-10k-metrics.xq' outputFile="filename.xml" /> > > > Thanks > -- > - > > Alex G. Muir > Software Engineering Consultant > Linkedin Profile : http://ca.linkedin.com/pub/alex-muir/36/ab7/125 > Love African Kora Music? Take a moment to listen to Gambia's - Amadu > Diabarte & Jali Bakary Konteh www.bafila.bandcamp.com Your support keeps > Africa's griot tradition alive... Cheers! > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
AM
Alex Muir19 Nov 2012 23:34 #
Hi, I've create a standalone script which creates a database and run's an xquery although I'm not clear on how to save the result of the xquery to file. generally I would like to create a database and run a series of xqueries each going to file rather than to the console output.
<?xml version="1.0" encoding="UTF-8"?>
<commands>
    <show-databases/>
<drop-db name="1997-i4enrich-10k"/>
    <create-db name="1997-i4enrich-10k"/>

    <add
path="1997-i4enrich-10k">/mnt/xslt_volume/i4ContentOutput/DebugSet/10k-GHU-2009/MDAFalse/Completed/</add>

    <info-db/>
    <run file='../xquery/section-10k-metrics.xq'/>
    <close/>

</commands>
I saw this on the documentation however I couldn't get it to work Q{java:java.io.FileOutputStream}new("output.txt") btw.. It might be nice to be able to say
<run file='../xquery/section-10k-metrics.xq' outputFile="filename.xml" />
Thanks
-- - Alex G. Muir Software Engineering Consultant Linkedin Profile : http://ca.linkedin.com/pub/alex-muir/36/ab7/125 Love African Kora Music? Take a moment to listen to Gambia's - Amadu Diabarte & Jali Bakary Konteh www.bafila.bandcamp.com Your support keeps Africa's griot tradition alive... Cheers!

⚡Generated with XQuery