XOMDestination
Added by Anonymous over 16 years ago
Legacy ID: #4854248 Legacy Poster: M (mjschehl)
There is no XOMDestination, so I am hoping that someone could tell me how to get the results from XQueryEvaluator.run() into an nu.xom.Nodes object. I thought SaxDestination would get me there, but I couldn't figure out how to do it.
Replies (3)
Please register to reply
RE: XOMDestination - Added by Anonymous over 16 years ago
Legacy ID: #4855325 Legacy Poster: Michael Kay (mhkay)
I can't see any obvious answer to this one. There might be something in Nux, but I can't immediately see it. I'll drop a note to Wolfgang Hoschek to see if he can help.
RE: XOMDestination - Added by Anonymous over 16 years ago
Legacy ID: #4857370 Legacy Poster: Michael Kay (mhkay)
After a short exchange with Wolfgang, and a poke around XOM and NUX source code, I don't think there's any way - even if you run the query directly under Nux - of building the result tree directly as a XOM tree, rather than generating it as something else and then converting. Nux hides the conversion but it's still happening underneath. There's code in XOM - the XOMHandler class - which implements a SAX ContentHandler and constructs a XOM tree from the received SAX events. But it's not public! You could make a copy of this class, make it public, and nominate it as a SAXDestination to Saxon, and I think your problem would be solved. The alternative is simply to generate lexical XML and reparse it. Michael Kay http://www.saxonica.com/
RE: XOMDestination - Added by Anonymous over 16 years ago
Legacy ID: #4861052 Legacy Poster: Michael Kay (mhkay)
I've now written a XOMWriter class which implements Result and Receiver and therefore can be used as the destination for a query or transformation. Wrapping a XOMDestination around it should be easy enough except for packaging issues - I don't particularly want to have a cross-link between the saxon-xom and saxon-s9api packages. I may leave this last step as an exercise for the reader - it's easy enough to wrap a Destination object around a given Receiver. I'll post a copy of the class to the Patches tracker so you can try it out. It's not tested with Saxon 9.0, but I don't see any reason why it shouldn't work. Please report any problems on this thread.
Please register to reply