Errata

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 12
2nd xml quote after 2nd paragraph

<?xml version="1.0" encoding="UTF8" standalone="no"?>

NOW READS:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

p. 27, code sample in middle of page.
<xs:element name="title">
<xs:complexType>
<xs:simpleContent>
<xs:restriction base="xs:string">
<xs:attribute ref="ora:series" use="required" />
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
</xs:element>

NOW READS:
<xs:element name="title">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute ref="ora:series" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>

This same change HAS BEEN MADE on p.25, where this same code is within the
larger file.

Anonymous    Jul 01, 2004
Printed
Page 31
First paragraph of XSLT, 5th line

For example, XSLT is instrumental is generating HTML or WML (Wireless Markup Language) from and XML document.
should be:
For example, XSLT is instrumental in generating HTML or WML (Wireless Markup Language) from and XML document.

Anonymous   
Printed
Page 45
code listing

public void buildTree(DefaultTreeModel treeModel,
DefaultMutableTreeNode base, File file)

NOW READS:
public void buildTree(DefaultTreeModel treeModel,
DefaultMutableTreeNode base, String xmlURI)

Anonymous    Jul 01, 2004
Printed
Page 57
middle of 1st code block

String attPrefix =
(String)namespaceMappings.get(namespaceURI);

NOW READS:
String attPrefix =
(String)namespaceMappings.get(attURI);

Anonymous    Jul 01, 2004
Printed
Page 60
Third paragraph; The DTD declaration of the mixed content model

<!ELEMENT p (b* | i* | a* | #PCDATA)>

NOW READS:
<!ELEMENT p (#PCDATA | b* | i* | a*)>

Anonymous    Jul 01, 2004
Printed
Page 73
second line of code sample

System.out.println(i);

NOW READS:
System.out.println(ch[i]);

Anonymous    Jul 01, 2004
Printed
Page 109
IN PRINT: Example 5-1, 7th line from bottom of page

System.exit(0);

NOW READS:
return;

Anonymous    Jul 01, 2004
Printed
Page 116-119
Code samples

The code samples on page 116-119 appear to always check for the NodeList (of child
nodes) being null.

This is unnecessary, as the DOM Level 2 specifications state that in the event of a
Node having no children, the childNodes attribute is a NodeList containing no nodes.
(as opposed to returning null)

AUTHOR: Note that this is only unnecessary if you have a DOM Level 2
implementation. Since many legacy parsers and applications still use
DOM Level 1, and since earlier versions of JAXP (often still in use)
also use DOM Level 1, it is unsafe, in the author's opinion, to make
assumptions about a DOM Level 2 specification. Therefore, the cost of a
single null-check is negligible in relation to ensuring that this code
works with /any/ DOM implementation.

Anonymous   
Printed
Page 129
Example 6-2. (continue); in the example code

DOMSerializer serializer = new DOMSerializer();
serializer.serializer(doc, new File(ITEMS_DIRECTORY + "item-" + name +
".xml"));

NOW READS:
DOMSerializer serializer = new DOMSerializer();
serializer.serializer(doc, new File(ITEMS_DIRECTORY + "item-" + id +
".xml"));

P. 146, bottom of page:
"You could just as easily provide values like
Node.SHOW_ELEMENT and Node.SHOW_TEXT..."

NOW READS:
"You could just as easily provide values like NodeFilter.SHOW_ELEMENT and
NodeFilter.SHOW_TEXT..."

Anonymous    Jul 01, 2004