Transform XML without DTD

Here should go questions about transforming XML with XSLT and FOP.
marijke
Posts: 2
Joined: Mon Apr 06, 2009 5:41 pm

Transform XML without DTD

Post 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.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Transform XML without DTD

Post 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
marijke
Posts: 2
Joined: Mon Apr 06, 2009 5:41 pm

Re: Transform XML without DTD

Post 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
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Transform XML without DTD

Post 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
Post Reply