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