Why don't just use the XMLWriter as it is, there is a write(Element) method
in it...
Like this:
try {
Document doc = DocumentHelper.createDocument();
doc.setRootElement(DocumentHelper.createElement("ROOT"));
doc.getRootElement().add(DocumentHelper.createElement("InsideRootElement"));
OutputFormat outPretty = OutputFormat.createPrettyPrint();
XMLWriter writePretty = new XMLWriter(System.out, outPretty);
writePretty.write(doc.getRootElement());
} catch (Exception e) {
e.printStackTrace();
}
Or did I not understand what you wanted to do?
Cheers Christian
> -----Ursprungligt meddelande-----
> Fr�n: Eric Jain [mailto:[EMAIL PROTECTED]]
> Skickat: den 15 juli 2002 15:18
> Till: dom4j
> �mne: [dom4j-user] How to printing large XML files
>
>
> While I am aware that large XML files can be read efficiently
> by providing
> custom ElementHandlers, is there any corresponding way to
> print out elements
> on the fly rather than printing complete trees?
>
> This would probably have to be accomplished by providing an
> option for the
> XMLWriter to suppress the begin and/or end tags of the root
> element of the
> tree that is being printed.
>
> Of course one could simply print out a start tag, and then
> loop through all
> elements printing them out. This approach however gets
> somewhat messy if
> multiple namespaces are used and you don't want to have the namespace
> declarations repeated for each element.
>
> Any ideas?
>
>
> --
> Eric Jain
>
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> dom4j-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
>
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user