You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Dylan Parker <dy...@mindstech.com> on 2001/03/15 00:02:18 UTC
Re[2]: HELP! WAR files, EntityResolvers, xsl:include, and me!
I believe URIResolver is the solution for XalanJ2... but alas I am
using Xalan1.2.2
My info:
- WebLogic 6.0
- Xalan 1.2.2
- Xerces 1.2.2
- XSL Tag Library 1.0
I believe I am correct in thinking that EntityResolver is the thing to
use with Xalan1.2.2?
How I can use that in the situation I describe in my original message?
(quoted at the bottom)
Thanks in advance!
Dylan Parker
Wednesday, March 14, 2001, 2:42:59 PM, you wrote:
> Hi,
> I actually think that what you need is a URIResolver. For your purpose, you
> would need to call setURIResolver on your transformerFactory if you're
> doing something like tranformerFactory.newTemplates(xslfile) or
> transformerFactory.newTransformer(xslfile).
> Myriam
> Dylan Parker <dy...@mindstech.com> on 03/14/2001 01:10:29 PM
> Please respond to xalan-dev@xml.apache.org
> To: xalan-dev@xml.apache.org
> cc: (bcc: Myriam Midy/CAM/Lotus)
> Subject: HELP! WAR files, EntityResolvers, xsl:include, and me!
> Hello, all.
> I asked this question in a petering off thread two days ago... and I
> know how _I_ am about reading old boring threads ;) so here goes
> again.
> I _originally_ asked if there was a workaround to allow xalan-j to
> read xsl files at runtime from an xsl:include tag, when the target xsl
> file to be read resides inside of a WAR file.
> So, to get the root xsl file read and parsed I can do.. since I am
> creating the InputSource... but the code to handle xsl:include's I
> can't intercept.... or so I thought.
> Joseph Kesselman politely nodded his head in the direction of
> entityResolvers and implied that I could write my own and use it to
> parse the WAR files.
> Very cool. But how?
> The documentation around the method setEntityResolver implies that by
> calling it you can add (or 'register') your resolver with the other
> resolvers currently registered... But in the Xalan code,
> StylesheetHandler.java to be specific -- which implements
> EntityResolver, the code the uses setEntityResolver appears to treat
> it like there can only be a single resolver at any one time...
> Which is it?
> In the documentation they have the following class :
> import org.xml.sax.EntityResolver;
> import org.xml.sax.InputSource;
> public class MyResolver implements EntityResolver {
> public InputSource resolveEntity (String publicId, String systemId)
> {
> if (systemId.equals("http://www.myhost.com/today")) {
> // return a special input source
> MyReader reader = new MyReader();
> return new InputSource(reader);
> } else {
> // use the default behaviour
> return null;
> }
> }
> }
> And the 'null' with the comment "use the default behaviour" implies
> that a series of resolvers are being tried...
> If I implement a class similar to the above that can handle reading
> from WAR files... how exactly can I make the bridge between Xalan and
> Xerces aware of it? The exact point I NEED the custom resolver is
> when Xalan comes across an xsl:include statement and must retrieve
> the file from inside of a WAR file...
> Can one register their EntityResolver in a queue of other
> EntityResolvers? So that each is tried in turn and the default
> behaviour used only when all 'registered' resolvers return null?
> If so... How exactly?
> If not... what do people suggest? What have other people done?
> Any help appreciated!
> Dylan Parker