This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Converting DOM to Qexo Infoset?
- From: Per Bothner <per at bothner dot com>
- To: Daniel Aborg <lists dot kawa at daborg dot fastmail dot fm>
- Cc: kawa at sources dot redhat dot com
- Date: Fri, 27 Apr 2007 22:11:33 -0700
- Subject: Re: Converting DOM to Qexo Infoset?
- References: <46324139.3090901@daborg.fastmail.fm>
Daniel Aborg wrote:
Hi,
I'm exploring using Qexo as an alternative to Saxon and I've run into a
bit of a snag.
We have an xquery script that takes DOM trees as external variables.
However, when I try to run this script in Qexo it tells me that it
expects a Qexo NodeType rather than a DOM Node. Based on this I'm
assuming that Qexo does not support natively accessing DOM trees and
that I must convert my DOM tree to a Qexo Infoset.
Basically Qexo has its own DOM implementation. If you compile
Kawa with JAVA5 features selected, then gnu.kawa.xml.KNode and
its subclasses will implement the standard DOM Node interfaces.
However, this is not the default because of binary incompatibile
changes in the Node interface between JDK 1.4 and 1.5. Sigh.
Unfortunately, I can't find any indication of how to do this in any of
the documentation, in the APIs, or in the sources themselves.
How would I go about converting a DOM tree to what Qexo expects so I can
pass it to the xquery script as an external variable?
I agree there should be a away to convert a org.w3c.dom.Node
to a gnu.kawa.xml.KNode object. It shouldn't be that difficult.
It would be somewhat easier to convert SAX event sequence to a Node,
since there is ready code for this: I just need to write an appropriate
10-line glue method. Will that work for you?
Is there some standard way to "serialize" a DOM to a SAX stream?
(It's obviously easy to do, but I don't want to needlessly
re-invent the wheel.)
--
--Per Bothner
per@bothner.com http://per.bothner.com/