Java and XML

Errata for Java and XML

Submit your own errata for this product.


The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update



Version Location Description Submitted By Date Submitted Date Corrected
Printed
Page 8
code sample

<body bgcolor="#ffffff"> <xsl:apply-templates/> </body> should be: <body bgcolor="#ffffff"> <xsl:apply-templates select="content/*"/> </body>

Anonymous   
Printed
Page 8
code sample 1-3

code sample: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> should be: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

Anonymous   
Printed
Page 24
Under Processors

XSL has just become a rec now reads: XSLT has just become...

Anonymous    Sep 01, 2000
Printed
Page 33-34
code sample

Every place it says "What's next", the single apostrophe is a right single quote, instead of an apostrophe. This should be changed in the typesetting.

Anonymous   
Printed
Page 40
code sample (1st)

<!-- Standard element with attribute --> <JavaXML:Chapter focus="XML"> should be: <!-- Standard element opening tag with attribute --> <JavaXML:Chapter focus="XML">

Anonymous   
Printed
Page 40
In the second paragraph from the bottom

"...Business Object not a..." now reads: "...Business Object is not a..."

Anonymous    Sep 01, 2000
Printed
Page 48
3rd para

The URL http://www.megginson.com/SAX/SAX2/javadoc/index.html should be: http://megginson.com/SAX/Java/javadoc/index.html. The URL http://www.megginson.com/SAX/SAX2 should be: http://www.megginson.com/SAX

Anonymous   
Printed
Page 53

There should be a footnote after code sample's last line that reads: Older versions of Apache Xerces allowed the use of normal Windows paths, but more recent versions replaced the java.net.URL class with a custom URL resolver, and requires filenames to be passed in as complete URIs, as shown in this example, with protocol (file://) and complete location (/d:/prod/JavaXML/contents/contents.xml) [66/67] code sample: On the first line of p.67, "rawName" should be changed to "qName" Same change on line 5 of this page, same code sample.

Anonymous   
Printed
Page 53
The example of command line has been changed to

D:prodJavaXML> java SAXParserDemo file:///d:/prod/JavaXML/contents/contents.xml Parsing XML File: file:///d:/prod/JavaXML/contents/contents.xml

Anonymous    Sep 01, 2000
Printed
Page 58
In the code sample the first method has been changed to

* @param ch <code>char[]</code> character array with character data. * @param start <code>int</code> index in array where data starts. * @param length <code>int</code> length of characters in array. * @throws <code>SAXException</code> when things go wrong. */ public void characters(char[] ch, int start, int length) throws SAXException { } ... * @param ch <code>char[]</code> character array with character data. * @param start <code>int</code> index in array where data starts. * @param length <code>int</code> length of characters in array. * @throws <code>SAXException</code> when things go wrong. */ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { }

Anonymous    Sep 01, 2000
Printed
Page 67
2nd code sample

The line: String s = new String(ch, start, end); should be: String s = new String(ch, start, length);

Anonymous   
Printed
Page 67
In the second code sample

* @param end <code>int</code> index in array where data ends. now reads: * @param length <code>int</code> length of characters in array. also: public void characters(char[] ch, int start, int end) now reads: public void characters(char[] ch, int start, int length)

Anonymous    Sep 01, 2000
Printed
Page 70
top code sample

String s = new String(ch, start, end); should be: String s = new String(ch, start, length);

Anonymous   
Printed
Page 70
In the first code sample

* @param end <code>int</code> index in array where data ends. now reads: * @param length <code>int</code> length of characters in array. also: public void ignorableWhitespace(char[] ch, int start, int end) now reads: public void ignorableWhitespace(char[] ch, int start, int length)

Anonymous    Sep 01, 2000
Printed
Page 71
bottom code sample

Add the lines: // Tun on namespace processing parser.setFeature("http://xml.org/sax/features/namespaces", true); directly before the line: // Parse the document parser.parse(uri);

Anonymous   
Printed
Page 71
right before last code sample

Change "Add the following lines to the demo() method" to read "Add the following lines to the performDemo() method"

Anonymous   
Printed
Page 71
The following line has been made bold

parser.setContentHandler(contentHandler);

Anonymous    Sep 01, 2000
Printed
Page 72
The example command line has been changed to

D:prodJavaXML> java SAXParserDemo file:///d:/prod/JavaXML/contents.xml Example 3-2 has been changed to: D:prodJavaXML> java SAXParserDemo file:///d:/prod/JavaXML/contents.xml Parsing XML File: file:///d:/prod/JavaXML/contents.xml

Anonymous    Sep 01, 2000
Printed
Page 74
end of 2nd para

Change "we want to address the issue of what happens when your XML document is not valid," to "we want to address the issue of what happens when your XML document does not adhere to the XML 1.0 specification,"

Anonymous   
Printed
Page 86
top code sample.

Change: "System.out.println("Error reaading URI: " + e.getMessage());" to: "System.out.println("Error reading URI: " + e.getMessage());" [Note correction in spelling of "reading"]

Anonymous   
Printed
Page 87
last code sample

Change: "System.out.print(i);" to: "System.out.print(ch[i]);"

Anonymous   
Printed
Page 96
last code sample

Change the DOCTYPE line to read: <!DOCTYPE JavaXML:Topic SYSTEM "DTDJavaXML.dtd"> [99/100] last code sample; Change the three <!ENTITY lines to: <!ENTITY amp "&"> <!ENTITY lt "<"> <!ENTITY gt ">"> ...

Anonymous   
Printed
Page 99
The last code example has been changed to

<!ENTITY OReillyCopyright "Copyright O&apos;Reilly and Associates, 2000">

Anonymous    Sep 01, 2000
Printed
Page 102
The first code example under "Either or" has been changed to

<!ELEMENT AggregateElement (#PCDATA | Element1 | Element2)*>

Anonymous    Sep 01, 2000
Printed
Page 103
middle code sample.

Change: <!ELEMENT JavaXML:Content (JavaXML:Chapter+, JavaXML:SectionBreak?)+)> to: <!ELEMENT JavaXML:Content ((JavaXML:Chapter+, JavaXML:SectionBreak?)+)> Same change on p. 104, 105, and 107.

Anonymous   
Printed
Page 103
In the code sample Example 4-9, the middle part has been changed to

<!ELEMENT JavaXML:Title (#PCDATA)> <!ELEMENT JavaXML:Contents (JavaXML:Chapter+,JavaXML:SectionBreak?)+> <!ELEMENT JavaXML:Chapter (JavaXML:Heading?,JavaXML:Topic+)> The same change (the middle line, in particular, in the change above) has been made on p. 104, 105, 107 Paragraph two, the first code sample, and paragraph three on p. 103 have been removed.

Anonymous    Sep 01, 2000
Printed
Page 104
In the code/DTD listing

<!ATTLIST JavaXML:Chapter focus [type] [Modifier] section [type] [Modifier] The section line has been removed, so it looks like this: <!ATTLIST JavaXML:Chapter focus [type] [Modifier]

Anonymous    Sep 01, 2000
Printed
Page 105

The section line has been removed in both the first and second listings (note that the /subSections/ line STAYS). The code samples should now read as follows. The first code example on the page should read: <!ATTLIST JavaXML:Book xmlns:JavaXML CDATA [Modifier] > <!ELEMENT JavaXML:Title (#PCDATA)> <!ELEMENT JavaXML:Contents (JavaXML:Chapter+, JavaXML:SectionBreak?)+)> <!ELEMENT JavaXML:Chapter (JavaXML:Heading?,JavaXML:Topic+)> <!ATTLIST JavaXML:Chapter focus [type] [Modifier] > <!ELEMENT JavaXML:Heading (#PCDATA)> <!ELEMENT JavaXML:Topic (#PCDATA)> <!ATTLIST JavaXML:Topic subSections CDATA [Modifier] > The second code example on the page should read: <!ELEMENT JavaXML:Chapter (JavaXML:Heading?,JavaXML:Topic+)> <!ATTLIST JavaXML:Chapter focus (XML|Java) [Modifier] > <!ELEMENT JavaXML:Heading (#PCDATA)>

Anonymous    Sep 01, 2000
Printed
Page 107
The first sentence has been changed to

In comparing our example XML document to its DTD... (rest is same)

Anonymous    Sep 01, 2000
Printed
Page 110
2nd code line

Should read: <JavaXML:Book xmlns:JavaXML="http://www.oreilly.com/catalog/9780596000165">

Anonymous   
Printed
Page 110
The first code line

<xsd:schema xmlns:xsd="http://www.w3.org/1999/XMLSchema"> now reads: <schema xmlns="http://www.w3.org/1999/XMLSchema">

Anonymous    Sep 01, 2000
Printed
Page 118
middle code sample.

Change near top: "<element name="Contents" type="JavaXML:ContentsType" />" to: <element name="Contents" type="JavaXML:ContentsType" maxOccurs="*"> (Change near bottom) from: "<element name="SectionBreak" minOccurs="0" maxOccurs="*">" to: "<element name="SectionBreak" minOccurs="0" maxOccurs="1">"

Anonymous   
Printed
Page 130
bottom code sample.

Change the first two lines to read: D:prodJavaXML> java SAXParserDemo file:///d:/prod/JavaXML/contents/contents.xml Parsing XML File: file:///d:/prod/JavaXML/contents/contents.xml

Anonymous   
Printed
Page 143
In the first sentence of the last paragraph

"For the duration of the this book..." now reads: "For the duration of this book..."

Anonymous    Sep 01, 2000
Printed
Page 153
sentence between examples 6-3 and 6-4. Change to

The result of transforming this data would be the HTML output shown in Example 6-4. We'll discuss how to make this happen in Chapter 7, but for now we'll focus purely on the XSL itself, not the process of transformation.

Anonymous   
Printed
Page 160
first sentence. Change to

By now, you're probably jumping at the chance to see how this transformation occurs. We'll cover this in the next chapter, but for now you need to get a firm understanding of the constructs within XSL.

Anonymous   
Printed
Page 185
bottom of page, change first line of code to

public void printNode(Node node) {

Anonymous   
Printed
Page 185
The first line of the code sample has been changed to

private static void printNode(Node node) {

Anonymous    Sep 01, 2000
Printed
Page 187
2nd line of code sample should be

System.out.println("<?xml version="1.0"?> "); [Keep same indentation]

Anonymous   
Printed
Page 187
The code sample has been changed to

case Node.DOCUMENT_NODE: System.out.println("<xml version="1.0"> "); Document doc = (Document)node; printNode(doc.getDocumentElement()); break;

Anonymous    Sep 01, 2000
Printed
Page 188
The code sample has been changed to

// recurse on each child NodeList children = node.getChildNodes(); if (children != null) { for (int i=0; i<children.getLength(); i++) { printNode(children.item(i)); } }

Anonymous    Sep 01, 2000
Printed
Page 190
Example 7-3: Change line

<xml version="1.0"> to: <?xml version="1.0"?>

Anonymous   
Printed
Page 191
code sample, line 5. Change to

System.out.println("<?xml version="1.0"?> ");

Anonymous   
Printed
Page 192
Example 7-4. Change line

<xml version="1.0"> to: <?xml version="1.0"?>

Anonymous   
Printed
Page 194
The commented code in the code sample has been changed to

/* Document doc = (Document)node; printNode(doc.getDocumentElement(), ""); */

Anonymous    Sep 01, 2000
Printed
Page 194
In the sixth line of the first paragraph

PrcoessingInstruction now reads: ProcessingInstruction

Anonymous    Sep 01, 2000
Printed
Page 195
In the third line of the first paragraph

"...we need to case our Node..." now reads: "...we need to cast our Node..."

Anonymous    Sep 01, 2000
Printed
Page 201
The import statement

import org.xml.sax.helpers.HandlerBase; has been changed to: import org.xml.sax.HandlerBase; since there is no such class as the former.

Anonymous    Sep 01, 2000
Printed
Page 209
The following line has been removed:

import org.jdom.input.Builder

Anonymous    Sep 01, 2000
Printed
Page 210
In the code sample,

Builder builder = new SAXBuilder(false); now reads: SAXBuilder builder = new SAXBuilder(false);

Anonymous    Sep 01, 2000
Printed
Page 211
In the code sample, the following line has been removed

import org.jdom.input.Builder; The line: Builder builder = new DOMBuilder("org.jdom.adapaters.OracleV2DOMAdapter"); has been changed to: DOMBuilder builder = [rest is same]

Anonymous    Sep 01, 2000
Printed
Page 211

The last sentence now reads: To use the default parser, simply call DOMBuilder builder = new DOMBuilder().

Anonymous    Sep 01, 2000
Printed
Page 217
2nd code sample. Change "window-managers" to "window-manager"

Anonymous   
Printed
Page 220
In the second paragraph under heading "Comments"

"the getContent() method" has been changed to: "the getMixedContent() method"

Anonymous    Sep 01, 2000
Printed
Page 222
In the code example, the following line has been removed

import org.jdom.input.Builder;

Anonymous    Sep 01, 2000
Printed
Page 223
In the code sample

Builder builder = new SAXBuilder(false); has been changed to: SAXBuilder builder = new SAXBuilder(false);

Anonymous    Sep 01, 2000
Printed
Page 224
In the code sample, the following line has been removed:

import org.jdom.input.Builder;

Anonymous    Sep 01, 2000
Printed
Page 225
In the code sample in the bottom of the page:

Builder builder = new DOMBuilder(true); has been changed to: DOMBuilder builder = new DOMBuilder(true); and (even more on the bottom of the page): Builder builder = new SAXBuilder(true); has been changed to: SAXBuilder builder = new SAXBuilder(true);

Anonymous    Sep 01, 2000
Printed
Page 229
In the code sample, the following line has been removed

import org.jdom.input.Builder;

Anonymous    Sep 01, 2000
Printed
Page 230
In the code sample,

Builder builder = new SAXBuilder(); now reads: SAXBuilder builder = new SAXBuilder();

Anonymous    Sep 01, 2000
Printed
Page 242
The third line

/usr/lib/jakarta-tomcat/conf/cocoon.properties has been changed to: cocoon.properties

Anonymous    Sep 01, 2000
Printed
Page 247
Example 9-2.

Line 12, change 'page-master-name="right"' to 'master-name="right"' Line 21 change 'page-master-name="left"' to 'master-name="left"' Line 31 change '<fo:page-sequence>' to '<fo:page-sequence master-name="right">'

Anonymous   
Printed
Page 281
last para. Add footnote to the word IDE in the second sentence that

reads: These instructions are for older versions of the XML-RPC package. Some newer versions include a pre-built jar file, which can be used without any modification.

Anonymous   
Printed
Page 296
The eleventh and on lines have been changed to

private static Vector events = new Vector(); /** Event details (name, time) */ private static Hashtable eventDetails = new Hashtable(); Also, the public Scheduler section has been changed to: public Scheduler() { }

Anonymous    Sep 01, 2000
Printed
Page 299
The code has been changed to

private static Vector events = new Vector(); /** Event details (name, time) */ private static Hashtable eventDetails = new Hashtable();

Anonymous    Sep 01, 2000
Printed
Page 300
In the second code sample, the public Scheduler section

has been changed to: public Scheduler { eventsSorted = true; }

Anonymous    Sep 01, 2000
Printed
Page 322
bullet last, change last item to

* Parser class for the client to use as a SAX driver.

Anonymous   
Printed
Page 332
In the code sample, the following line has been removed

import org.jdom.input.Builder

Anonymous    Sep 01, 2000
Printed
Page 333
code listing

Change all occurrences of "getContent()" to "getText()" (do not change things like getIntContent(), though).

Anonymous   
Printed
Page 333
In the code sample

Builder builder = new DOMBuilder(... has been changed to: DOMBuilder builder = new DOMBuilder(...

Anonymous    Sep 01, 2000
Printed
Page 341
In the code sample

Builder builder = new DOMBuilder(... has been changed to: DOMBuilder builder = new DOMBuilder(...

Anonymous    Sep 01, 2000
Printed
Page 343
right after 1st code sample, add this sentence

You will also need to add several import statements: <code> import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.helpers.XMLReaderFactory; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; </code>

Anonymous   
Printed
Page 346
In the code sample

doc.getElementsByTagNameNS(NAMESPACE_URI, "hostname"); has been changed to: root.getElementsByTagNameNS(NAMESPACE_URI, "hostname");

Anonymous    Sep 01, 2000
Printed
Page 347
after code listing, add sentence

You also need to import these classes: <code> import org.apache.xerces.parsers.DOMParser; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; </code>

Anonymous   
Printed
Page 351
In the code sample, the following line has been removed

import org.jdom.input.Builder

Anonymous    Sep 01, 2000
Printed
Page 354
In the code sample at the bottom of page

Builder builder = new DOMBuilder(... has been changed to: DOMBuilder builder = new DOMBuilder(...

Anonymous    Sep 01, 2000
Printed
Page 362
In the code sample, the following line has been removed:

import org.jdom.input.Builder

Anonymous    Sep 01, 2000
Printed
Page 364
In the first code snippet, the following line has been removed

import org.jdom.input.Builder

Anonymous    Sep 01, 2000
Printed
Page 365
code sample

Change all occurrences of setContent() to setText()

Anonymous   
Printed
Page 368
In the code sample, the following line has been removed:

import org.jdom.input.Builder

Anonymous    Sep 01, 2000
Printed
Page 383
In the code sample

<input type="reset" value="Rest Form"... has been changed to: <input type="reset" value="Reset Form"...

Anonymous    Sep 01, 2000
Printed
Page 398
code sample

Change the code in the catch block to: ServletOutputStream out = res.getOutputStream();

Anonymous   
Printed
Page 404
In the code sample, the following line has been removed

import org.jdom.input.Builder; In the middle of the page: Builder builder = new SAXBuilder(); has been changed to: SAXBuilder builder = new SAXBuilder();

Anonymous    Sep 01, 2000
Printed
Page 406
In the second code snippet

Builder builder = new SAXBuilder(); has been changed to: SAXBuilder builder = new SAXBuilder();

Anonymous    Sep 01, 2000
Printed
Page 409
In the third line

"...system and send an email." now reads: "...system and sends an email."

Anonymous    Sep 01, 2000
Printed
Page 423
The code sample

</simpleType now reads: </simpleType>

Anonymous    Sep 01, 2000
Printed
Page 430
For the Attributes class listing

public abstract String getRawName (int index); has been changed to: public abstract String getQName (int index); and these methods: public int getIndex (String rawName); public abstract String getType (String rawName); public abstract String getValue (String rawName); now all have: rawName changed to: qName

Anonymous    Sep 01, 2000
Printed
Page 431
For the ContentHandler interface listing

public void startElement(String namespaceURI, String localName, String rawName, Attributes atts) throws SAXException; now reads: public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException; and: public void endElement(String namespaceURI, String localName, String rawName) throws SAXException; now reads: public void endElement(String namespaceURI, String localName, String qName) throws SAXException;

Anonymous    Sep 01, 2000
Printed
Page 447
The following two method signatures need to be added to the Element

class's API reference: public boolean hasAttribute(String name); public boolean hasAttributeNS(String namespaceURI, String localName);

Anonymous