Hi Vincent,

i'm trying to reproduce your problem.

This is what I did.

$ wget http://files.basex.org/releases/latest/BaseX83-20150825.081504.zip
$ unzip BaseX83-20150825.081504.zip 
$ ./bin/basexgui

GUI:

declare option db:chop 'false';
declare option db:dtd 'true';
declare option db:catfile 'etc/catalog.xml';
 
let $xmlFile := 'etc/factbook.xml'
let $parsed := doc($xmlFile)
let $report := validate:dtd-report($xmlFile)
return ($report, $parsed)

Result

<report>
  <status>invalid</status>
  <message level="Error" line="2" column="10" 
url="file:/Users/holu/code/test/basex/etc/factbook.xml">Document root element 
"mondial", must match DOCTYPE root "null".</message>
  <message level="Error" line="2" column="10" 
url="file:/Users/holu/code/test/basex/etc/factbook.xml">Document is invalid: no 
grammar found.</message>
</report>
<mondial>
  <continent id="f0_119" name="Europe"/>
  <continent id="f0_123" name="Asia"/>
  <continent id="f0_126" name="America"/>
  <continent id="f0_129" name="Australia/Oceania"/>
  ...

Can we try to 'model' your problem using data that is available in the public?

Thanks
        A. Holupirek

> On 02.09.2015, at 03:18, Lizzi, Vincent <[email protected]> 
> wrote:
> 
> It appears that the Validate module is not using catalogs. I’m working with 
> XML that contains a DTD DOCTYPE declaration with a public identifier and a 
> system identifier that contains the filename of the DTD, and I have set up a 
> catalog that provides the DTD location. Here is a rough example:
>  
> declare option db:chop 'false';
> declare option db:dtd 'true';
> declare option db:catfile 'schemas/catalog.xml';
>  
> let $xmlFile := ‘path/to/file.xml’
> let $parsed := doc($xmlFile)
> let $report := validate:dtd-report($xmlFile)
> return ($report, $parsed)
>  
> This fails on the validate:dtd-report line. The error report indicates that 
> BaseX is trying to find the DTD in the same folder as the XML file.
>  
> I know the catalog is working because the doc() call is parsing the XML and 
> populating default attributes, and if I remove the db:catfile option 
> declaration the doc() call fails.
>  
> If I add a path to the DTD in the second parameter in 
> validate:dtd-report($xmlFile, ‘path/to/dtd.dtd’) the validation works. I’m 
> not sure why this is needed because the XML contains a DOCTYPE and the 
> catalog should be resolving the DTD location. 
>  
> Is this intentional? There are use cases to require that validation is done 
> using a specific DTD and not simply any DTD that the XML happens to declare. 
> In other cases however it is easier to validate using the DTD that is already 
> identified in the DOCTYPE of the XML file. Is this a bug?
>  
> Thanks,
> Vincent

Reply via email to