Summary

Serialization is the process of taking an in-memory DOM data structure such as a Document object and writing it out onto a stream as bytes or characters. DOM Level 2 and earlier do not include any standard classes or interfaces for performing serialization. Consequently every implementation of DOM must provide its own unique API for performing this necessary task. In Xerces, that need is filled by XMLSerializer class. The OutputFormat class stores the various configuration options for an XMLSerializer including encoding, white space added for pretty printing, line separator, maximum line width, which elements to output using CDATA sections, and more.

DOM Level 3 finally adds a standard set of serialization interfaces. The DOMWriter interface provides basic methods for serializing a Document object onto a stream or into a string. The insignificant formatting of the output can be controlled by setting various features such as format-canonical and discard-default-content to either true or false. A DOMWriterFilter can control which nodes are output.


Copyright 2001, 2002 Elliotte Rusty Haroldelharo@metalab.unc.eduLast Modified February 08, 2002
Up To Cafe con Leche