Xquery - Output DocType

Questions about XML that are not covered by the other forums should go here.
jon
Posts: 7
Joined: Thu Mar 06, 2014 9:14 pm

Xquery - Output DocType

Post by jon »

Hi all,

I have an xquery file (.xql) that I use to generate an XML table via an xquery module (.xqm).
The module contains a function that generates a table similar to this:

Code: Select all


<Doctype>
<Table>
<Row>
<Entry>
</Entry>
</Row>
</Table>
</Doctype>
I retrieve this table in the .xql file.
Now, I would like to add a doctype on top of that table, to look like this:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Doctype PUBLIC "my-doctype-public" "my-doctype.dtd">
<Doctype>
...
</Doctype>
Note that I use xquery 3.0. I found that I should be able to output the doctype by declaring an option on top of the .xql file (right below 'xquery version "3.0";') like this:

Code: Select all


declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method "xml";
declare option output:media-type "text/xml";
declare option output:omit-xml-declaration "no";
declare option output:indent "yes";
declare option output:doctype-public "my-doctype-public";
declare option output:doctype-system "my-doctype.dtd";
I tried this both in the .xql and .xqm files, without success.
Hard-coding the doctype in the .xqm doesn't work either.

Does any of you have an idea for this?

Thanks in advance,
Jonathan
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Xquery - Output DocType

Post by adrian »

Hi,

What XQuery engine are you using for this (eXist, Saxon XQuery) and with what version of Oxygen?

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
jon
Posts: 7
Joined: Thu Mar 06, 2014 9:14 pm

Re: Xquery - Output DocType

Post by jon »

Hi Adrian,

I use eXist 2.1 for this application. Via the eXide dashboard, I just run the "Run" command and get the output in the "XML Output" console, which also is on the Dashboard.
I don't use oXygen here.
Post Reply