O'Reilly logo

XML and Java™ from scratch by Nicholas Chase

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required