DOM Level 3

DOM Level 3 (DOM3) will finally add a standard load-and-save package, making it possible to write completely implementation-independent DOM programs. This package, org.w3c.dom.ls, is identified by the feature strings LS-Load and LS-Save. The loading part includes the DOMBuilder interface you've already encountered. The saving part is based on the DOMWriter interface. DOMWriter is more powerful than XMLSerializer. Whereas XMLSerializer is limited to outputting documents, document fragments, and elements, DOMWriter can output any kind of node at all. Furthermore, you can install a filter into a DOMWriter to control its output.

As shown by the method signatures in Example 13.3, DOMWriter can copy a Node object from memory into serialized ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.