Errata for Effective XML

All known problems in Effective XML are posted here. These are based on the first printing. If you spot any mistakes that are not listed here, please send them to so we can correct them in future printings.

Item 3, page 11: A question mark is missing from the XML declaration at the bottom of the page.

<?xml version="1.0" encoding="UTF-8">

should be:

<?xml version="1.0" encoding="UTF-8"?>

Item 3, page 14. A question mark is missing from both XML declarations.

<?xml version="1.1">

should be:

<?xml version="1.1"?>

Item 11, p. 60: In the second code fragment, the Year element end-tag is missing a slash. It should read


Item 11, p. 65: In the second line, the Family start-tag is missing. It should read

<Name><Given>Lenny <Middle>Alfred</Middle> <Family>Bruce</Family></Name>

A little further down the same page the Family end-tag is missing from Anita Hoffman. That line should read:

<Name><Title>Ms.</Title> <Given>Anita</Given> <Family>Hoffman</Name>

Finally in the penultimate and antepenultimate lines, the Given end-tag is missing. These should read:

<Name><Family>Kawabata</Family> <Given>Yasunari</Given></Name>

Item 15, p. 87:

element == null;

Should be:

element = null;

That is, use the assignment operator rather than the equality operator.

Item 19, p. 110: In the fifth item in the list, a period is missing at the end of the sentence, "You can indicate that a line can be continued on the next line by adding a single equals sign at the very end of the line"

Item 20, p. 113: The end-tag </chess game> should be </chess:game>.

Item 21, p. 120: This document was so deliberately perverse and confusing, I managed to screw it up. The xmlns:fo namespace declaration should be xmlns:xsl. That is, The root element start-tag should be


p. 121 has a similar mistake. Here <stylesheet should be <xsl:stylesheet .

Item 24, p. 136. The isPrime() method returns boolean. That is,

public void isPrime(String text) {

should be

public boolean isPrime(String text) {

Item 38, p. 221: In the first paragraph, Lichenstein should be Liechtenstein.

Item 39, p. 222: In the last code example, in the last line of code on the page,

<xsl:variable name="columns">2<xsl:variable>

should be

<xsl:variable name="columns">2</xsl:variable>

Item 50, p. 285: The two code fragments incorrectly capitalize GZIPInputStream and GZIPOutputStream. They should read

Document doc;
// load the document...
try {
  OutputStream fout    = new FileOutputStream("data.xml.gz");
  OutputStream out     = new GZIPOutputStream(fout);
  OutputFormat format  = new OutputFormat(document);
  XMLSerializer output = new XMLSerializer(out, format);
catch (IOException ex) {

From this point forward you neither need to know nor care that the data is compressed. It’s all done behind the scenes automatically.

Input is equally easy. For example, suppose later later you want to read data.xml.gz back into your program. Decompression adds just one line of code to hook up the GZIPInputStream.

  InputStream fin = new FileInputStream("data.xml.gz");
  InputStream in  = new GZIPInputStream(fin);
  DocumentBuilderFactory factory 
    = DocumentBuilderFactory.newInstance();   
  DocumentBuilder parser = factory.newDocumentBuilder();
  Document doc = parser.parse(in);
  // work with the document...

[ Cafe con Leche | Effective XML | Corrections | Order ]

Copyright 2006 Elliotte Rusty Harold
Last Modified November 18, 2006