Hi Gary. I think we need to find another way. We're trying very hard to
have the DTM not point out of org.apache.xml (hopefully there are no hacks
that do this now).
Brainstorming:
1) Create an interface in org.apache.xml, say XMLReaderInitializer. That
could have one method initXMLReader(...). Have XPathContext implement
this, and pass it to the 20,000 other arguments of getDTM(...). (Or,
better, have a setXMLReaderInitializer method on the DTMManager).
2) Save the first XMLReader created, and then get the fields from that for
subsequent XMLReaders. This would probably work today, but will have
problems in a scenario where the DTMManager is shared among multiple
processes (we hope to work towards that...).
3) Have the caller implement a URIResolver that returns a SAXSource that
contains an XMLReader, and the caller can set whatever their dear heart
desires. (I think you had a discussion about this a while ago... is there a
JAXP 1.1 contract that says that we'll propigate entity resolvers?)
So probably #1 is the best solution, though #3 is the ideal solution.
-scott
Gary L Peskin
<garyp@firste To: Xalan Development
<[EMAIL PROTECTED]>
ch.com> cc: (bcc: Scott Boag/CAM/Lotus)
Subject: Help re bugfix retrofit
06/14/2001
11:43 PM
Please
respond to
xalan-dev
Scott et al --
I need to retrofit my fix for Bug 1830 into the DTM version of XalanJ.
However, this will require a change to DTMManager and DTMManagerDefault
so I wanted to check in with you and let you know what I'm doing and see
if you think its okay or have an idea for another approach.
The problem reported in this bug is that EntityResolvers set in the
primary XMLReader are not propagated through to subsequent XMLReaders.
For example, when the document() function is used, an XMLReader is
created automatically in DTMManagerDefault.getXMLReader() but the
EntityResolver is not propagated into the automatically created reader.
In order to propagate the EntityResolver, I need to get the existing
EntityResolver from the primary reader at the time that the new
XMLReader is created. This is contained in the XPathContext but no
context is currently available to the DTMManager, even though the
DTMManager is created by the XPathContext and nowhere else. So, my idea
is to add a field to the DTMManager for the creating XPath instance.
Then, when the new XMLReader is created, the DTMManager implementation
can call back to the XPathContext to get the primary reader and then get
its EntityResolver and set that into the newly created reader.
I don't really see another way to do it but I was interested in your
thoughts. I hate to add a reference in the DTMManager to its creating
XPathContext but I didn't think I had a choice.
Thoughts?
Gary