Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using an XML Catalog with a Java library that uses JAXP internally

Tags:

java

xml

catalog

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?

like image 725
Brian Ferris Avatar asked Jun 18 '10 07:06

Brian Ferris


1 Answers

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

like image 110
Jim Garrison Avatar answered Oct 10 '22 21:10

Jim Garrison