Dummy DTDs and Catalog files for transformation
Posted: Wed Jan 25, 2012 10:48 pm
Hi there
Having read a previous post (http://www.oxygenxml.com/forum/topic3418.html) I found that I could define a dummy dtd in my catalog to get around transforming XML files for which I did not have the DTD. This works really well (although the Xerces parser complains in the Oxygen message pane, it still allows the transformation to proceed).
What's interesting is that you can add entity declarations in the dummy dtd and these will automatically be resolved by the Saxon XSLT processor. This is helpful as you could have an XML document for which you do not have the DTD but that contains a bunch of XHTML character entities and all you need to do is point to them in your dummy.dtd and these will be resolved and rendered correctly.
However, for this to work I still need to add a dummy declaration at the top of each file so that the dummy.dtd gets invoked by the catalog.
So my question is: is it possible to define a 'default' catalog mapping for documents for which there is no DTD declaration? I.e. given a document
<foo>
<bar>[full document content here containing stuff like é etc]</bar>
</foo>
a dummy DTD could be invoked if suitably defined in the catalog file?
This would be an immense help as it would pretty much allow any XML document from any source, with or without a DTD and with or without unresolved entity references, to be transformed.
Cheers
Phil
Having read a previous post (http://www.oxygenxml.com/forum/topic3418.html) I found that I could define a dummy dtd in my catalog to get around transforming XML files for which I did not have the DTD. This works really well (although the Xerces parser complains in the Oxygen message pane, it still allows the transformation to proceed).
What's interesting is that you can add entity declarations in the dummy dtd and these will automatically be resolved by the Saxon XSLT processor. This is helpful as you could have an XML document for which you do not have the DTD but that contains a bunch of XHTML character entities and all you need to do is point to them in your dummy.dtd and these will be resolved and rendered correctly.
However, for this to work I still need to add a dummy declaration at the top of each file so that the dummy.dtd gets invoked by the catalog.
So my question is: is it possible to define a 'default' catalog mapping for documents for which there is no DTD declaration? I.e. given a document
<foo>
<bar>[full document content here containing stuff like é etc]</bar>
</foo>
a dummy DTD could be invoked if suitably defined in the catalog file?
This would be an immense help as it would pretty much allow any XML document from any source, with or without a DTD and with or without unresolved entity references, to be transformed.
Cheers
Phil