URI/Entity Resolver Not Called?
Added by Michael Livingston almost 12 years ago
For the life of me I cannot figure out how to get my URI or Entity resolver to be called for a file included as an external entity file. Here is a fragment of the stylesheet:
%dynamic; ]>
My goal is to resolve dynamic.ent at runtime, setting various entities as needed. I have set the URI resolver on the transformer factory and tried a number of other angles, but when I try to get the transformer my resolver is not hit and the call fails trying to find the "file" dynamic.ent.
What must I do to get the XML parser to hit my resolver?
Thanks in advance,
Michael
Replies (2)
RE: URI/Entity Resolver Not Called? - Added by Michael Kay almost 12 years ago
The URIResolver is used by the XSLT/XQuery engine to resolve URIs found at that level of the system; entity references within a document are handled by the XML parser, and use an EntityResolver.
So you need an EntityResolver here. Create an XMLReader, set the EntityResolver, wrap it in a SAXSource, and supply this as the input to the transformation (in this case, when creating the Templates object, assuming you are using JAXP).
RE: URI/Entity Resolver Not Called? - Added by Michael Livingston almost 12 years ago
Hi Michael,
Thanks for the quick reply! It took me a little while to implement your suggestion but it work great and I am on my way. I did get quite a bit of insight in to how the documents are managed: I have quite a few imports and includes and see how they are handled individually.
Again, thanks for you help...
Michael
Please register to reply