tags:

views:

86

answers:

1

I'm using the Apache web service xml rpc library to make requests to an rpc service. Somewhere in that process is a xml document with a DTD reference to http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd, which the library attempts to download when parsing the XML. That download fails with a 503 status code because the w3c is blocking repeated downloads of this largely static document from Java clients.

The solution is XML Catalogs to locally cache the DTD. However, while I can find examples of setting an EntityHandler on a JAXP SAXParser instance directly to enable catalog parser support, I don't actually have access to the underlying parser here. It's just being used by the xml rpc library. Is there any way I can set a global property or something that will tell JAXP to use XML catalogs?

A: 

I think you want the system property xml.catalog.files.

Take a look at http://xml.apache.org/commons/components/resolver/resolver-article.html

BTW, this was the third hit on a Google search for jaxp catalog

Jim Garrison
I'd seen that article and I've already attempted to integrate xml-resolver into my project. The problem is that the xml.catalog.files system property only takes affect once you've installed the XML Resolver as your entity resolver on your JAXP reader instance. My problem is that I don't have access to the JAXP reader instance used internally by the web service library.
Brian Ferris
If you set that property on the command line when launching the program, does it not get "seen" by the parser factory?
Jim Garrison