Corrections to Chapter 8 of Java Network Programming, HTML in Swing

p. 250: At the very top of the page, change Parser.getParser() to Parser getParser(). That is, change the period to a space.

p. 252: The first paragraph; refers to the ParserGetter class from Example 8-5. However, ParserGetter is actually Example 8-6

P. 258: To make Outliner work with documents that use a meta tag such as <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">, you need to change

parser.parse(r, callback, false);

to

parser.parse(r, callback, true);

This tells the parser to ignore the character set header. To really make it work with other character sets, you need to detect the character set using the URLConnection class described in Chapter 15.

p. 265: Two changes should be made to Example 8-10 on this page. First you need to test if the local directory exists before trying to make it. That is, change

if (localDirectory.mkdirs()) {

to

if (localDirectory.exists() || localDirectory.mkdirs()) {

Next, to make PageSaver work with documents that use a meta tag such as <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">, you need to change

parser.parse(r, callback, false);

to

parser.parse(r, callback, true);

This tells the parser to ignore the character set header. To really make it work with other character sets, you need to detect the character set using the URLConnection class described in Chapter 15.


[ Java Network Programming Corrections | Java Network Programming Home Page | Table of Contents | Examples | Order from Amazon ] ]

Copyright 2001, 2003 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified January 7, 2003