Errata

SAX2

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page 20
3rd paragrapch

The sentence

"XML includes Document Type Declarations, or DTDs."

should read

"XML includes Document Type Definitions, or DTDs."

These terms are easily confused!

Anonymous   
Printed Page 25
Example 2-1

Forgive me if this is obvious to a SAX/java old hand, but I'm not!
I tried compiling and running the very basic example as a test of my new SDK 1.4
installation and it spat out the create of the XMLReader saying that the system
property org.xml.sax.driver wasn't specified.
Having dug much deeper, it turns out that I need to either set this property to
org.apache.crimson.parser.XMLReaderImpl either in the command line or in a
System.setProperty() call.
This is sort of explained (well, for a newbie!) in Chapter 3 but the class name is
(possibly incorrectly) shown as org.apache.crimson.XMLRedaerImpl
Also, on Page 17, the implication is that for a JDK 1.4 installation, nothing further
needs to be done.
Happily the author's Top Ten Tips article on www.oreilly.com shows the class name and
makes it clear that you do need to do something about associating the crimson
implementation with the contructor, despite the fact that it's embedded.
As I said at the start, all of the above may be mis-understandings due to my lack of
experience, but I did find it confusing.

Anonymous   
Printed Page 25-26
error in Example 2.1

The variable producer is defined in one try block (near the bottom of page 25) and
then used in another try block (near the top of page 26) I thought this looked
funny. I typed it in and got an uninitialized variable error.

Anonymous   
Printed Page 31
3

No object specified, in example on page 31, for
method setContentHandler (....
Would appear to be producer.setContentHander( new XMLWriter.....

Anonymous   
PDF Page 35
Example 2-2

Example 2-2. Printing only character content (a simple example)

public class Example extends DefaultHandler {
public void characters (char buf [], int offset, int length)
throws SAXException
{
System.out.write (new String (buf, offset, length));
}
}

"System.out.write" is a private method, so that the example cannot be compiled, but this is working:

class Example extends DefaultHandler {
public void characters (char buf [], int offset, int length)
throws SAXException
{
System.out.print (new String (buf, offset, length));
}
}

Anonymous  Mar 01, 2015 
Printed Page 90
Example 3.3, line 30

retval.setInputSource (new ByteArrayInputStream (data));

setInputSource is a method of javax.xml.transform.sax.SAXSource, not of
org.xml.sax.InputSource.

The correct way is in the creation moment
InputSource retval = new InputSource(new ByteArrayInputStream (data));

Anonymous   
Printed Page 109
third line, within example

In the example that spans pages 108-109, a custom SAXParseException is created with
three parameters for the purpose of providing more robust Exception handling.

Then, in the third line on page 109, the custom Exception is disgarded, and the
generic exception is thrown instead, defeating the purpose of the example.

Shouldn't the third line read:

errHandler.error(spe)

instead of

errHandler.error(e)
?

Anonymous   
Printed Page 128
Last paragraph

A little nit:

Relax-NG

should be

RELAX NG

It would also be nice to add a reference to the language's web site
(http://www.oasis-open.org/committees/relax-ng/).

Anonymous   
Printed Page 134
5th paragraph

A tiny nit:

RELAX-NG

should be

RELAX NG

Anonymous   
Printed Page 165
5th line

public class RssGenServlet extend HttpServlet

should read

public class RssGenServlet extends HttpServlet
^

It is only "serious" because it won't compile without this change.

Anonymous