Out of curiosity, is it possible to work with (validate against) a DTD file stored as binary in BaseX? I imagine something like using a catalog to resolve DTD references in XML files to DTD files stored in BaseX might work.
Thanks, Vincent
From: basex-talk-bounces@mailman.uni-konstanz.de [mailto:basex-talk-bounces@mailman.uni-konstanz.de] On Behalf Of Christian Grün Sent: Thursday, January 07, 2016 3:00 AM To: Wang, Yvonne yvonne.wang@sap.com Cc: basex-talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] best approach to add dtd file into baseX
Hi Yvonne,
The canonical solution is to store and retrieve your file as binary file [1]. Instead of fn:doc, you can use db:retrieve to access this resource [1].
Hope this helps, Christian
[1] http://docs.basex.org/wiki/Databaseshttp://docs.basex.org/wiki/Databases
On Thu, Jan 7, 2016 at 1:33 AM, Wang, Yvonne <yvonne.wang@sap.commailto:yvonne.wang@sap.com> wrote:
Hi,
I have sample dtd file such as below, I want to add the dtd file as is in baseX.
Since the dtd file is not in xml format, there are currently two option I can thought about
- Use TEXT as input format
When I add it using baseX client UI, I got following output. Since we just need store the dtd file and later get it back as is. So I can not use doc function to retrieve it back as is.
<text>
<line><dtd></line>
<line><!--</line>
<line><?xml encoding="UTF-8"?></line>
<line/>
<line> <tmpComment>Sample rng file comments</tmpComment></line>
<line/>
<line><!ELEMENT first (#PCDATA)></line>
<line/>
<line><!ELEMENT last (#PCDATA)></line>
<line/>
<line><!ELEMENT user (first,last)></line>
<line><!ATTLIST user</line>
<line> xmlns:xsi CDATA #FIXED 'http://www.w3.org/2001/XMLSchema-instancehttp://www.w3.org/2001/XMLSchema-instance'</line>
<line> xsi:schemaLocation CDATA #FIXED 'http://ariba.com.com/Core_after_xsd.xsd%27%3E;http://ariba.com.com/Core_after_xsd.xsd'></line>
<line>--></line>
</text>
- Format it to xml using <dtd> <!—original data --> </dtd> when
add, and remove those dtd and comment tag when download using doc() function.
And there is extra handling required for nested xml comment.
Is there any other better approach for adding dtd file which can be retrieved as its original content?
Thanks
Yvonne
===========================================================================================================================
Sample.dtd
<?xml encoding="UTF-8"?>
<!-- Sample rng file comments -->
<!ELEMENT first (#PCDATA)>
<!ELEMENT last (#PCDATA)>
<!ELEMENT user (first,last)>
<!ATTLIST user xmlns:xsi CDATA #FIXED 'http://www.w3.org/2001/XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>'
xsi:schemaLocation CDATA #FIXED 'http://ariba.com.com/Core_after_xsd.xsdhttp://ariba.com.com/Core_after_xsd.xsd'>