Jiří,
you can set serialization parameters to include doctypes in the query output:
$ basex -s doctype-system=subjects.dtd -q "<document/> <!DOCTYPE document SYSTEM "subjects.dtd">
or, using BaseX commands:
set serializer doctype-system=subjects.dtd xquery <document/>
The serialization features have been added after the official release; please compile the sources, or run the latest Maven build:
http://www.inf.uni-konstanz.de/dbis/basex/maven/org/basex/basex/6.0.6/
The official docs on serializing XSLT and XQuery can be found at: http://www.w3.org/TR/xslt-xquery-serialization/
Christian
2010/4/1 Michael Seiferle michael.seiferle@uni-konstanz.de:
Dear Jiri,
after a quick look at the code I have to confirm that the doctype is not preserved by the parser. As Christian wrote it I am sure he will provide us with further information on this.
As a quick and rather dirty fix you might rewrite the Doctype declaration as a processing instruction
<?DOCTYPE document SYSTEM "subjects.dtd"?>
and take care of that prior to importing / after exporting. Sorry for not having a more convenient solution at the moment, we'll keep you updated.
Kind regards Michael
Am 01.04.2010 um 14:27 schrieb Jiří Kadlec:
Thanks Michael
It works well. May I ask one more question. Is it possible to preserve doctype declaration in same way. For e.g I have documet which looks like this one:
<?xml version="1.0" standalone="no" ?>
<!--define the location of the external DTD using a relative URL address-->
<!DOCTYPE document SYSTEM "subjects.dtd">
<document> <title>Subjects available in Mechanical Engineering.</title> <subjectID>2.303</subjectID> ... </document>
and when I export the document I loose information about DOCTYPE and connection to DTD, is there any way how to do this.
Thank you very much
Jiri
------------ Původní zpráva ------------ Od: Michael Seiferle michael.seiferle@uni-konstanz.de Předmět: Re: [basex-talk] Leave whitespaces in XML when loading XML file with new CreateDB Datum: 31.3.2010 18:02:29
Hi Jiri,
you may set the properties for the given Context by simply calling:
// set CHOP to false CONTEXT.prop.set("CHOP",false);
If you are looking at the Example at [1] & [2]: http://www.inf.uni-konstanz.de/dbis/basex/code.php?code=DatabaseExample You would want to put the Prop change right before calling the CreateDB statement.
Hope this works out for you, don't hesitate to ask for more :-).
Kind Regards Michael
[1] http://www.inf.uni-konstanz.de/dbis/basex/code.php?code=DatabaseExample
[2] You may check your DB either via console, by open <dbname> and then info or in the GUI with help of the OPEN Dialog
Am 31.03.2010 um 16:38 schrieb Jiří Kadlec:
Hi Guys,
How can I preserve whitespaces in XML document, when i'm using new
CreateDB(..) object for creating new database from Java code. When I export data with new Export(..) I get document with choped whitespaces. I found out, that there is a possibility to preserve whitespaces when I create DB from BaseX gui. There is a possibility to uncheck option chop whitespaces which gives me required result. Is there any way how to do this from Java.
Thank you
Jiri _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
___________________________
Christian Gruen Universitaet Konstanz Department of Computer & Information Science D-78457 Konstanz, Germany Tel: +49 (0)7531/88-4449, Fax: +49 (0)7531/88-3577 http://www.inf.uni-konstanz.de/~gruen