JAXP Serialization

Although DOM is a read-write API in memory, it's sorely lacking when it comes to moving its in-memory data structure back out onto a disk, a network socket, or some other stream. Eventually, this omission will be rectified in DOM3. In the meantime, you have the choice of using either implementation-specific serialization classes or JAXP. The implementation-specific serialization classes generally provide more customization and features, but JAXP is sufficient for basic uses.

JAXP doesn't include a serialization package, but you can hack basic output through the javax.xml.transform package by conveniently “forgetting” to install a transform. :-) The pattern is the same as parsing a document with JAXP. The basic steps are as ...

Get Processing XML with Java™: A Guide to SAX, DOM, JDOM, JAXP, and TrAX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.