Title: RE: Alternative location for DTDs

I am using Xalan 2.1. Too chicken for betas!

The code that invokes my entity resolver looks like:

                Transformer transformer = t.newTransformer();

                xalanOutStream = new ByteArrayOutputStream();

                // Added to hook in my EntityResolver
                InputSource inputSource = new InputSource(reader);

                XMLReader xmlReader = XMLReaderFactory.createXMLReader();

                xmlReader.setEntityResolver(entityResolver);
                // END Added to hook in my EntityResolver

                SAXSource saxSource = new SAXSource(xmlReader, inputSource);

                transformer.transform(saxSource, new StreamResult(xalanOutStream));

t is a Templates object.

This is the only way I could hook in. I looked for a feature or -D setting, but to no avail...

Chris Raber, Systems Engineer, AvantGo Inc.
http://www.avantgo.com/

-----Original Message-----
From: William A. McArthur, Jr [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 06, 2001 3:27 PM
To: Christopher Raber
Cc: '[EMAIL PROTECTED]'
Subject: Re: Alternative location for DTDs

Chris,
I've been trying to get a custom Entity resolver to locate DTDs but it
isn't being called. What version of Xalan are you using and could I
maybe see a quick example that works for you?

thanks,
Sandy McArthur

Christopher Raber wrote:

> I answered this a little hastily. You could simply locate your DTD in a
> central place (say a WEB server) and have all your references to it by
> the central URL.
>
>
>
> You still might want to look at Entity Resolver though. I have found
> that providing a caching entity resolver significantly improves performance.
>
>
>
> Chris Raber, Systems Engineer, AvantGo Inc.
>
> http://www.avantgo.com/
>
>
>
> -----Original Message-----
> *From:* Christopher Raber [mailto:[EMAIL PROTECTED]]
> *Sent:* Wednesday, December 05, 2001 12:48 PM
> *To:* 'Lajos Moczar'; '[EMAIL PROTECTED]'
> *Subject:* RE: Alternative location for DTDs
>
>
>
> You can provide your own entity resolver. This can improve performance too!
>
> Chris Raber, Systems Engineer, AvantGo Inc.
http://www.avantgo.com/
>
> -----Original Message-----
> From: Lajos Moczar [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 05, 2001 12:39 PM
> To: [EMAIL PROTECTED]
> Subject: Alternative location for DTDs
>
> Hi all -
>
> This problem is driving me crazy. I have a bunch of xml files to process
> with Xalan, each in a separate dirctory. All the XMLs have a DTD
> declaration like this:
>
> <!DOCTYPE FRUID_XML_Tree SYSTEM "mydoc.dtd">
>
> The problem is that I don't want to have to copy mydoc.dtd into each
> directory. Ideally, I'd like to ignore the DTD declaration, but
> alternatively I need to at least be able to tell Xalan to look for the
> dtd in a different directory (like the directory where the xsl file is).
> Originally, I thought that I could use a custom URIResolver for this,
> but it appears that the URIResolver is not called to resolve DTD locations.
>
> Can anyone suggest anything? I have this problem with serveral different
> applications and I'm at a loss as to what to do.
>
> Regards,
>
> Lajos

Reply via email to