Serializing the Document

In Java, the notion of serializing was first used in references to objects. In serializing an object, we essentially save it to a file so it can be re-created (or unserialized) later.

We do the same with XML documents. In fact, the XML files we've been dealing with all this time are serialized versions of XML documents. It's the in-memory documents that really deserve the name.

When we were saving our orders.xml file in Chapter 5, what we were really doing was serializing the JDOM document and saving it to a file—even though we called it outputting. Now, when we're dealing with straight DOM, we'll use the proper name: serialization.

In Listing 6.8, we change the output of the servlet from descriptions of the original ...

Get XML and Java™ from scratch 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.