Title: Message
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.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of James Strachan
Sent: Friday, June 14, 2002 4:11 AM
To: David Hooker; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [dom4j-user] Converting dom4j to saxon tree

How about using the JAXP API?
 
Document doc = ...;
Source source = new DocumentSource( doc );
 
see the end of the quick start guide for more details...
 

James
----- Original Message -----
Sent: Thursday, June 13, 2002 7:49 PM
Subject: [dom4j-user] Converting dom4j to saxon tree

I need to convert a dom4J Document into a Saxon tree to pass to Saxon during a transform.  Does anyone have some example code?  Does anyone know how to do it?  Even sample code for converting from a dom4j Document to another tree structure would be fine (JDOM for example).
 
Thanks!
 
 

Reply via email to