[jdom-interest] Duh solution (Re: org.xml.sax.EntityResolver)

Sirtaj Singh Kang ssk at physics.unimelb.EDU.AU
Tue Jun 27 21:34:39 PDT 2000


On Mon, Jun 26, 2000 at 02:06:26PM +1000, Sirtaj Singh Kang wrote:
> On Thu, Jun 01, 2000 at 07:12:02PM -0700, Kevin Regan wrote:
> > 
> > My application needs to be able to resolve the external entities
> > in an XML document, mapping them to local DTDs/Schemas.  I use the
> > org.xml.sax.EntityResolver class to do this.  Would it be possible to
> > allow access to the underlying SAX parser when using the SAXBuilder?
> > This would allow other important aspects of
> 
> I have this problem too, we are using a database to store our DTDs and I
> can't find a way to set the EntityResolver in the underlying SAX driver.

I don't know why this solution escaped me before, but I fixed this with a
simple custom class:

class MySAXParser extends org.apache.xerces.parsers.SAXParser
{
	public MySAXParser()
	{
		super();
		setEntityResolver( new MyEntityResolver() );
	}
}

and creating the SAXBuilder with:

SAXBuilder builder = new SAXBuilder( "MySAXParser", true );

duh duh duh

-Taj.

Sirtaj S. Kang       taj at kde.org         ssk at physics.unimelb.edu.au
Univ of Melbourne	The "gui" in "Penguin" is pronounced "K-D-E"



More information about the jdom-interest mailing list