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/Databases


On Thu, Jan 7, 2016 at 1:33 AM, Wang, Yvonne <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
>
>
>
> 1. 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>&lt;dtd&gt;</line>
>
> <line>&lt;!--</line>
>
> <line>&lt;?xml encoding="UTF-8"?&gt;</line>
>
> <line/>
>
> <line> &lt;tmpComment&gt;Sample rng file
> comments&lt;/tmpComment&gt;</line>
>
> <line/>
>
> <line>&lt;!ELEMENT first (#PCDATA)&gt;</line>
>
> <line/>
>
> <line>&lt;!ELEMENT last (#PCDATA)&gt;</line>
>
> <line/>
>
> <line>&lt;!ELEMENT user (first,last)&gt;</line>
>
> <line>&lt;!ATTLIST user</line>
>
> <line> xmlns:xsi CDATA #FIXED
> 'http://www.w3.org/2001/XMLSchema-instance'</line>
>
> <line> xsi:schemaLocation CDATA #FIXED
> 'http://ariba.com.com/Core_after_xsd.xsd'&gt;</line>
>
> <line>--&gt;</line>
>
> </text>
>
>
>
> 2. 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'
>
> xsi:schemaLocation CDATA #FIXED 'http://ariba.com.com/Core_after_xsd.xsd'>
>
>