atom feed5 messages in net.sourceforge.lists.saxon-helpRe: [saxon] wiring an EntityResolver ...
FromSent OnAttachments
picoJan 10, 2007 11:42 am 
picoJan 10, 2007 11:44 am 
Michael KayJan 11, 2007 3:51 pm 
Houghton,AndrewJan 12, 2007 10:10 am 
Michael KayJan 12, 2007 10:47 am 
Subject:Re: [saxon] wiring an EntityResolver into saxon
From:Michael Kay (
Date:Jan 11, 2007 3:51:01 pm

Basically, you construct a SAXSource object that contains an XMLReader object, having first called setEntityResolver() on the XMLReader to make it use your chosen EntityResolver. Then you pass the SAXSource as the input to Saxon, e.g. on the transform(source, result) method.

If the transformation reads additional source documents using functions such as doc() or document(), and you want your EntityResolver to be used on these, then you have two options:

(a) write a URIResolver which processes the supplied URI and returns a SAXSource constructed as above, or

(b) write your own implementation of XMLReader which is essentially just a wrapper around the "real" XMLReader, but which always sets the EntityResolver of the real XMLReader on initialization; then supply the name of your private XMLReader class to the method transformerFactory.setAttribute(FeatureKeys.SOURCE_PARSER_NAME, "your.xmlreader.class").

-----Original Message----- From: [] On Behalf Of pico Sent: 10 January 2007 19:43 To: Subject: [saxon] wiring an EntityResolver into saxon

There is a lot of info in this forum about defining a custom EntityResolver class to resolve schemas, DTDs, entities, etc.

I'd like to code a simple EntityResolver used when transforming an XHTML document using XSLT. This is to prevent network trips during the transform. I understand from other threads here that SAXParser is doing the remote requests, not Saxon. But I don't understand how to tell saxon to tell SAXParser to use a custom EntityResolver.

How can this be wired up?

I have Saxon B 8.8.04.

Thank you...