On Tuesday, January 8, 2002, at 10:52 AM, Timothy M. Dean wrote:
No, I did not call setNamespace in the Lexus implementation of the XUpdateQuery interface. My reasons for not making this change were:
1) At the time I was making this change I had not yet figured out where the CVS repository for Lexus was, so I was trying to avoid any Lexus changes if possible.
2) The Xindice implementation (in XUpdateImpl.java) completely overrides the execute() method defined by the Lexus implementation (in XUpdateQueryImpl.java). Any changes I made to the Lexus superclass in order to fix the problem would have had to be duplicated in the XIndice implementation.
3) Making the change in Lexus would probably be best if we could refactor Xindice's execute() method a little bit - Not being intimately familiar with Xindice or Lexus I was a little hesitant to go that far.
Because I didn't call the setNamespace() method, I used an alternate approach to pass the namespace into Lexus - My approach was a bit of a hack. I used the fact that the Lexus implementation uses a single static XPath instance to evaluate its XPath selection. So, I used the static CommandObject.getXPath() method to get that XPath instance, and then set the namespace directly on the XPath instance.
Looking back at it now, there are probably a couple of things that be refactored a bit to allow my changes to be rolled more directly into Lexus rather than doing it completely within Xindice. It would be necessary to modify Xindice's implementation of the execute() method so that it delegates most of the work back to the Lexus implementation (in it's superclass). It looks like the only Xindice-specific needs are to do some special checks for "Compressed Nodes" after the query has been executed. If we could change the implementation to call super.execute() and then do its compressed node checks, then we could move the namespace logic into the Lexus superclass, and remove the slight hack I used to pass namespace nodes directly to the XPath instance.
If you and the Xindice guys (Kimbro and Tom, I presume) would like me to make these further changes, please let me know and I will give it a whirl.
If you can refactor the code to use more of Lexus without losing anything then please do.
BTW, if you're really interested in digging into this we can probably look at getting you commit.
- Tim
Kimbro Staken XML Database Software, Consulting and Writing http://www.xmldatabases.org/