There's no standard API for converting a DOM into textual XML syntax.
That's one of the things on the list to be looked at in DOM Level 3.
Meanwhile, most parsers come with a generator/"unparser" sample program.
For example, IBM's XML4C package (and the Apache version of that code, I
presume) includes the DOMWriter application. (It also includes a
corresponding SAXWriter.)
______________________________________
Joe Kesselman / IBM Research