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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access