On 5. May 2018, at 20:09, Marco Randazzo Marco.Randazzo@iit.it wrote:
Hello, I used baseX gui to create a database from the following test file:
<main xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="folder1/file1.xml" /> <xi:include href="folder2/file1.xml" /> </main>
The Result of the baseX gui is correct:
<main xmlns:xi="http://www.w3.org/2001/XInclude"> <data xml:base="folder1/file1.xml">5555</data> <data xml:base="folder2/file1.xml">6666</data> </main>
Now, after editing the values, I would like to export the contents of the database to xml files, recreating the same folders and files (I see this information stored in the value of xml:base) However, using the export function available in the GUI, I am able only to obtain a single file containing the Result shown above. What should I do? Thank you Cheers Marco Randazzo
Hi Marco,
the export function in the GUI will, as you have noticed, dump the content of the database as XML to a file.
To recreate the file hierarchy with the changed XML data a little bit of XQuery is needed. A small example (just to sketch the idea):
```xquery let $xml := <main xmlns:xi="http://www.w3.org/2001/XInclude"> <data xml:base="/tmp/file1.xml">5555</data> <data xml:base="/tmp/file2.xml">6666</data> </main> for $data in $xml/data let $fpath := $data/@xml:base/data() return file:write($fpath, $data) ```
Cheers, Alex