XML Catalog with systemId=name of dtd

Having trouble installing Oxygen? Got a bug to report? Post it all here.
matthieu.ricaud
Posts: 20
Joined: Fri Apr 22, 2011 4:17 pm

XML Catalog with systemId=name of dtd

Post by matthieu.ricaud »

Hello,

I'm using oXygen 12.1 and I've have trouble with validating XML documents using my own XML catalog.

The XML documents to validate has such a doctype :

Code: Select all

<!DOCTYPE livre SYSTEM "mydtd.dtd">
(this cannot be changed, and the file can be anywhere on the filesystem)

In my XML Catalog I have :

Code: Select all

<system systemId="mydtd.dtd" uri="file:///C:/mypath/mydtd.dtd"/>
I declare the catalog within oXygen and whenever I try to validate my XML file oXygen is complaining it can't access the DTD (FileNotFoundException).

i'm sure it is parsed because other documents with publicId defined in the same catalog are validated

According to http://www.oxygenxml.com/pipermail/oxyg ... 00393.html (maybe too old ?) it seems oXygen doesn't like relative uri as systemId and with replace it with absolute uri, and then don't find the good entry in the catalog?
Does any systemId ending with ".dtd" is considered as relative uri?
Is there a way to solve this?

Can someone help me fixing this validation ?

Thanks
adrian
Posts: 2850
Joined: Tue May 17, 2005 4:01 pm

Re: XML Catalog with systemId=name of dtd

Post by adrian »

Hello,

If the value of the systemId attribute from the system element in the catalog is a relative path it will never get resolved. The catalog resolver compares this value to the actual systemID to be resolved, which is absolute, and as a result they never match.


You can correctly resolve this by using an XML Catalog 1.1(File -> New ->) with:

Code: Select all

<systemSuffix systemIdSuffix="mydtd.dtd" uri="file:///C:/mypath/mydtd.dtd/>
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
matthieu.ricaud
Posts: 20
Joined: Fri Apr 22, 2011 4:17 pm

Re: XML Catalog with systemId=name of dtd

Post by matthieu.ricaud »

Thanks a lot Adrian, it works now :-)

I'm just astonished about "id" consideration : to me, an "id" is a string that has not to be resolved. But well in Doctype declaration, the systemId is an uri to the file, so I understand it has to be resolved.
I find the vocabulary is a bit confusing actually.

I was wondering if the fact that my systemId contains ".dtd" was important or not.
I juste test with a dummy id :

Code: Select all

<!DOCTYPE livre SYSTEM "foo">
It's just doesn't work at all (whatever the XML Catalog declaration) : oXgen says there is no schema or DTD associated with the file.

I thougt this systemId could be see as just a ID/IDREF binding to the catalog, but it's not so simple.. It is an URI no less, no more, i'll remember that !

Anyway I know how to do so it works now,
Thanks again,
Regards,
Matthieu.
adrian
Posts: 2850
Joined: Tue May 17, 2005 4:01 pm

Re: XML Catalog with systemId=name of dtd

Post by adrian »

Well, actually the XML specification doesn't restrict the DOCTYPE systemID to a URI(any id string is allowed) but it does mention that it is meant to be converted to a URI reference.
http://www.w3.org/TR/xml/#NT-ExternalID

Regarding the lack of '.dtd' extension: It should work, I don't see something in the specification to prevent this. However, Oxygen uses the file extension('.dtd') from the systemID to determine the type of schema validator that is needed.
I've added this to our issue tracking tool and we will resolve it in a future version of Oxygen.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
matthieu.ricaud
Posts: 20
Joined: Fri Apr 22, 2011 4:17 pm

Re: XML Catalog with systemId=name of dtd

Post by matthieu.ricaud »

Thank you for the explanation and the link to the spec.

systemId="foo" was just a test case, but yes as you said it should work.
Thank you for adding this to oXygen issus tracker, I just wonder how it's going to be solved ? wait and see ;-)
I think there is no requirement in the spec that a DTD file should have ".dtd" extension ?
I'm actually not fan of using extension to determinate the kind of file to be handle. I prefer "mime-type" mechanisme or xml namespace in xml processing. But well dtd is not xml...

I now would like to make my saxon.jar (command line XSLT transformation) aware of my new catalog, it seems I need resolver.jar. I know it out of oXygen topic (saxon command line is not in the oXygen Licence) but any tips or internet links would be welcome :-)

Best Regards,

Matthieu
adrian
Posts: 2850
Joined: Tue May 17, 2005 4:01 pm

Re: XML Catalog with systemId=name of dtd

Post by adrian »

It's in the DocBook XSL documentaion but it's for the command line Saxon, so it's useful:
How to use a catalog file|Using catalogs with Saxon

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
matthieu.ricaud
Posts: 20
Joined: Fri Apr 22, 2011 4:17 pm

Re: XML Catalog with systemId=name of dtd

Post by matthieu.ricaud »

thank you Adrian.

Matthieu
adrian
Posts: 2850
Joined: Tue May 17, 2005 4:01 pm

Re: XML Catalog with systemId=name of dtd

Post by adrian »

Hello,

I just wanted to let you know that the systemID problem in DOCTYPE declarations (.dtd suffix required when not needed) has been resolved in the latest maintenance build of Oxygen 13.2, 2012052412:
Validation/Content Completion: Validation against DTD did not work, if the systemID from the DOCTYPE declaration in the XML file did not have the ".dtd" suffix.
You can download it from our web site:
http://www.oxygenxml.com/download.html

The list of bug-fixes can be found here:
http://www.oxygenxml.com/build_history.html#2012052412

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply