MessageDavid and I have shared a few off-list emails. Just to clarify for
those on the list, to convert from dom4j into Saxon's TinyTree you can use
the following code which David has checked works...
// dom4j document
Documet document = ...;
// now convert to Saxon tiny tree...
Source source = new DocumentSource(document);
TinyBuilder builder = new TinyBuilder();
return builder.build(source);
James
----- Original Message -----
From: David Hooker
To: 'James Strachan' ; [EMAIL PROTECTED] ;
[EMAIL PROTECTED]
Sent: Friday, June 14, 2002 9:53 PM
Subject: RE: [dom4j-user] Converting dom4j to saxon tree
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...
http://dom4j.org/guide.html
James
----- Original Message -----
From: David Hooker
To: [EMAIL PROTECTED] ; [EMAIL PROTECTED]
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!
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
----------------------------------------------------------------------------
Bringing you mounds of caffeinated joy
>>> http://thinkgeek.com/sf <<<
_______________________________________________
dom4j-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-dev