Page 1 of 1
Transform XML without DTD
Posted: Mon Apr 06, 2009 5:50 pm
by marijke
I want to transform an xml-document to another xml-document, using a stylesheet. But the source xml contains a doctype declaration with an external reference to a dtd. I don't want to use this dtd! But Oxygen doesn't want to transform without it ("no such file entry"). Is there a possibility to transform anyway?
I'm using Oxygen 10.1.
Re: Transform XML without DTD
Posted: Mon Apr 06, 2009 5:58 pm
by sorin_ristache
Hello,
If the DTD cannot be located the XML file is not well-formed so it cannot be transformed. You should remove or comment out the DTD reference or you should
set an XML catalog that maps the DTD reference used in the XML file to a copy of the DTD file that exists on your computer.
Regards,
Sorin
Re: Transform XML without DTD
Posted: Tue Apr 07, 2009 2:46 pm
by marijke
Hey Sorin,
Thanks for your reply. The problem is that I want to convert xml files and I don't have the dtd. The xmls are created by others. And I want to convert a lot of xml files, so removing the DTD reference is not an option.
When I'm using XML Spy, this DTD reference is no problem (then I have other problems

)
Marijke
Re: Transform XML without DTD
Posted: Tue Apr 07, 2009 3:12 pm
by sorin_ristache
The DTD reference cannot be ignored in an XML document. If the XML document contains a reference which cannot be resolved that is an error that stops parsing that XML document. So if you cannot remove the DTD references from the XML files you have to map them to references to local copies of the DTDs
using an XML catalog.
If there are no declarations of the DTD that are needed in the XML document you can just create a dummy DTD file and map all the DTD references to this dummy DTD with
an XML catalog set in your user preferences that contains an element like:
<systemSuffix systemIdSuffix=".dtd" uri="dummy.dtd"/>
where dummy.dtd is an empty file that exists in the same folder as the XML catalog file.
Regards,
Sorin