[oXygen-user] How To: Use Trang with Catalog-Based Resolution (DTD-to-Schema)

Sorin Ristache
Fri Jan 4 07:53:27 CST 2008


Hello,

The XML catalogs set in oXygen is used correctly by Trang for converting
XML inputs but not for converting DTD ones because Trang uses a custom
non JAXP parser for parsing a DTD input, that is
com.thaiopensource.xml.dtd.parse.DtdParserImpl which uses a custom non
JAXP resolver. You can modify this DTD parser class by setting your own
custom entity resolver which uses the oXygen catalog resolver class
(ro.sync.xml.catalogresolver.CatalogResolverFactory.CatalogEntityResolver
available in oxygen.jar) instead of setting an instance of
com.thaiopensource.xml.dtd.app.UriEntityManager on the line 143 of
com.thaiopensource.relaxng.input.dtd.DtdInputFormat which is an internal
Trang class. On line 143 of DtdInputFormat:

    Dtd dtd = new DtdParserImpl().parse(uri, new UriEntityManager());

you should replace UriEntityManager with your own resolver, for example:

    Dtd dtd = new DtdParserImpl().parse(uri, new 
CustomCatalogResolverManager());

To replace Trang's version of DtdInputFormat with your modified version 
just package your version and your custom entity resolver in a jar file, 
place this jar file in the folder [oXygen-install-folder]/lib/endorsed 
and restart oXygen.

We will add such a custom entity resolver for Trang's DTD inputs in a 
future version of oXygen but it should not be difficult to implement it 
and set it yourself in the meantime.


Regards,
Sorin


Eliot Kimber wrote:
> I'm trying to use Trang through Oxygen to create flat schemas from my 
> local shells and specializations. I immediately ran into the problem 
> that all my stuff depends on catalogs and it looks like Trang isn't 
> using the catalogs configured in the main editor.
> 
> Is there an easy way to hook in the catalogs?
> 
> Thanks,
> 
> Eliot




More information about the oXygen-user mailing list