Previous Section  < Day Day Up >  Next Section

Q&A

Q1:

What's the purpose of the DOCTYPE statement in the XML file produced by the PropertyFileCreator application?

A1:

That's a reference to a document type definition (DTD), a file that defines the rules XML data must follow to be considered valid in its dialect.

If you load the web page referred to in that statement, http://java.sun.com/dtd/properties.dtd, you'll find references to each of the elements and attributes contained in the XML file produced by the Java 2 library's Properties class.

Although Sun provides this DTD, Java's official documentation indicates that it shouldn't be relied upon when evaluating property configuration data. Parsers are supposed to ignore it.

Q2:

An XML file I want to load in a Java program makes use of indentation. How can I strip this out before reading it?

A2:

You don't need to strip out indentation and other whitespace. These characters are insignificant in XML, so the Builder class will ignore them when parsing an XML document.

The nu.xom package includes a Serializer class that can set the indentation for XML data, formatting it uniformly when writing the data to a file.

Q3:

Why is junk e-mail called spam?

A3:

Spam, which today describes a wide variety of undesirable junk messages cluttering the Internet, was named after a famous Monty Python's Flying Circus skit.

In the skit, a restaurant works Spam luncheon meat into each of its menu choices. Dishes include egg and Spam; bacon and Spam; bacon, sausage, and Spam; and lobster thermidor aux crevettes with a mornay sauce garnished with truffle pate' brandy and a fried egg on top of Spam.

As for the food, the Hormel Company chose the name by combining the words "spices" and "ham."

    Previous Section  < Day Day Up >  Next Section