Chapter 13. Output from DOM

Traditionally, one area in which DOM has been quite weak is serialization, the outputting of an in-memory DOM Document object into a text file. In fact, it's even possible to use DOM to create Document objects that cannot be serialized as well-formed XML files. (For example, DOM allows an element to have attributes with the same namespace prefix but different namespace URIs.) Serialization has been left for vendor-specific classes such as Xerces' XMLSerializer. However, DOM Level 3 adds several classes for writing XML documents into files, onto the network, or anything else you can hook an OutputStream to.

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.