Saxon
will only accept trees that are implemented by it's own tree model. It
doesn't understand dom4j trees. Saxon does have a JDOM adapter which will
convert trees. What I am attempting is this:
ByteArrayOutputStream outBytes
= new ByteArrayOutputStream();
XMLWriter writer = new XMLWriter(outBytes); writer.write(document); // a dom4j Document ByteArrayInputStream inBytes = new ByteArrayInputStream(outBytes.toByteArray()); InputSource inSource = new InputSource(inBytes); SAXSource saxSource = new SAXSource(inSource); TinyBuilder builder = new TinyBuilder(); return builder.build(saxSource); TinyBuilder is a Saxon class which creates a Saxon tree model from a
SAXSource. So in effect, I have to flatten the Document to XML in a
buffer, and stream that into the builder.
I
haven't tested it yet, though.
|
Title: Message
- [dom4j-dev] Converting dom4j to saxon tree David Hooker
- [dom4j-dev] Re: [dom4j-user] Converting dom4j to saxon... James Strachan
- [dom4j-dev] Re: [dom4j-user] Converting dom4j to s... David Hooker
- [dom4j-dev] Re: [dom4j-user] Converting dom4j ... James Strachan
- RE: [dom4j-dev] Re: [dom4j-user] Convertin... David Hooker