I am using StAX to construct an XML document using an XMLStreamWriter.
However, there are portions of my document where it is difficult to make calls to XMLStreamWriter’s methods one-by-one, and it would be easier to construct a small document fragment using DOM, then write that out.
I know how to use DOM, but here’s my question: is there an easy way to take an Element object and write it out to an XMLStreamWriter?
I can probably figure out how to “connect” the two methods, but it seems like it would be tedious & something should be out there already. (going the other way appears to be trivial: http://blogs.oracle.com/venu/entry/constructing_dom_using_stax_writers)
never mind, I got something that covers the basics (not sure it would work w/ namespaces but it seems to work w/ simple a DOM node tree):