Python & XML

Errata for Python & 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 25
5th full paragraph (Under "The ASCII character set" heading)

In the second sentence the word "ever" should be replaced with the word "every". ASCII is understood by virtually ever computer in use. should be: ASCII is understood by virtually every computer in use.

Anonymous    Nov 08, 2013
Printed
Page 33
3rd full paragraph

In the second sentence the word "on" should be replaced with the word "of". ...processing instruction is entirely a matter on convention; the... should say: ...processing instruction is entirely a matter of convention; the...

Anonymous    Nov 08, 2013
Printed
Page 36
6th paragraph

The first sentence, which begins with "We can break up the declaration in particular systactic components..." should read: "We can break up the declaration into particular syntactic components..."

Anonymous    Nov 08, 2013
Printed
Page 52
code example at the bottom of the page

In the last line of the <body> element replace the word "exhibition" with the word "expedition."

Anonymous    Nov 08, 2013
Printed
Page 53
-- first code snippet -- change the following

------------------------------------------------------------------------ # - ArticleHandler (add to handlers.py file) class ArticleHandler(ContentHandler): """ A handler to deal with articles in XML """ ------------------------------------------------------------------------ to this: ------------------------------------------------------------------------ from xml.sax.handler import ContentHandler class ArticleHandler(ContentHandler): """A handler to deal with articles in XML""" ------------------------------------------------------------------------ *** p. 54 -- Remove the following line of output from the top of the page: Start element: title *** p55, Example 3-3, first line: Change "XML.sax.handler" to "xml.sax.handler" (all lower case).

Anonymous    Nov 08, 2013
Printed
Page 56
last output paragraph

The body part of the outpur from the art.py program is too long. It should end after "completed " because self.body=self.body[:78]+ "...". If you also used the spacing indentation in the article.xml example the body part text should stop at "NASA has com" *** No change required for reprint. But for confirmed errata page say: The exact end of the text will depend on the specific indentation used in the article.xml file, as well as whether the indentation uses space or tab characters. *** p. 57-58 -- All double-underscores "__" in code and prose should have a hair-space between the underscores. Would it be possible to search all of Chapter 3 for this and fix all of them? *** p60, Example 3-4. 9th line on page: "def __init__(..." should be indented two spaces. *** p68, Example 3-6, replace the first 11 lines: ------------------------------------------------------------------------ from xml.sax import ContentHandler class SAXThumbs(ContentHandler): """ This is the SAX handler that generates a full- image display (an .html page) for each image file contained in the XML file. It also adds an anchor on the thumbs page showing the thumbnail, and linking to the big image page that was created first. ------------------------------------------------------------------------ with these 11 lines: ------------------------------------------------------------------------ import os from xml.sax import ContentHandler class SAXThumbs(ContentHandler): """ This is the SAX handler that generates a full-image display (an .html page) for each image file contained in the XML file. It also adds an anchor on the thumbs page showing the thumbnail, and linking to the big image page that was created first. *** p68, Example 3-6, last 5 lines on page should be replaced with: ------------------------------------------------------------------------ fullImageFile = os.path.join(dir, localname[2:]) + ".html" print "Will create:", fullImageFile fullImageHTML = ('<html><body><img src="%s%s"></body></html> ' % (localname[2:], ext)) ------------------------------------------------------------------------ Please keep all lines at current indentation. *** p75, Example 3-9, startElement() method: The "print" statement should be commented out; change: print "* Processing:", s to: # print "* Processing:", s Please maintain same indentation of line as we have now. *** p. 98 -- fix the 2 "__" on this page by inserting hair spaces. *** p. 100 -- fix the 2 "__" on this page by inserting hair spaces. *** p153, command line example at bottom of page, first line should be: C:>python c:python20xmldocdemoxmlprocxvcmd.py order.xml In other words, change "$ " at beginning of line to "C:>" *** p155, new_element_type() method, replace: ------------------------------------------------------------------------ def new_element_type(self, elem_name, elem_cont): print "New Element Type Declaration: ", elem_name, "Content Model: ", elem_cont ------------------------------------------------------------------------ with: ------------------------------------------------------------------------ def new_element_type(self, elem_name, elem_cont): print "New Element Type Declaration: ", elem_name print "Content Model: ", elem_cont *** p168, command line example in the middle of the page should be: C:9780596001285c7>python val.py BillSummary.xml In other words change "c6" to "c7" *** p173, Example 7-14, 3/4 of the way down the page, the line: flatfile = query.getvalue("flatfile", "")[0] should be: flatfile = query.getvalue("flatfile", "") In other words, drop the "[0]" at the end. Please maintain the same indentation. *** p174, Example 7-14, near the end, the line: if veh.errors: should read: if hasattr(veh, "errors") and veh.errors: {sample code - retrive.py} the line - print " of " + totalsize should be print " of ", totalsize

Anonymous   
Printed
Page 178
3rd paragraph following Business Process and Modeling

U of UML is the initial of "Unified". *** p193, Example 8-4, halfway down the page, change: req = HTTP("192.168.1.23") # change to your IP or localhost to: req = HTTP("127.0.0.1") # change to a different IP if needed

Anonymous    Nov 08, 2013
Printed
Page 205
last sentence of 1st paragraph

Duplicate word "shared". p. 233 -- paragraph under "Getting Profiles" -- change last sentence to read: In a simple test case (in the file <I>runcp.py</I>), you could use the methods as follows: p. 233 -- command line at bottom of the page -- change from: G:9780596001285c9>python runcp.py to: G:9780596001285c10> python runcp.py

Anonymous    Nov 08, 2013
Printed
Page 236
Last sentence of 1st paragraph

Extra "you": "...the order you in which you..." p. 239 -- first code example -- the line "else:" is out-dented by one space; it should be moved right one space so that "else:" lines up with "if e is not None:" *** p244, Example 10-2, 1/3 of the way down the page, change: raise exception.Exceptions("SQL Exec failed.") to: raise Exception("SQL Exec failed.") Please maintain current indentation of line. p. 261 -- code example at the top of the page (cont. from previous page) -- "if(dom):" should be changed to simply "if dom:" (no change to alignment) *** p. 266-267 -- fix the various "__" on these pages by inserting hair spaces.

Anonymous    Nov 08, 2013
Printed
Page 268
Line -2 in Example 10-11

Typo in print statement: "Reponse: " should be: "Response: "

Anonymous    Nov 08, 2013
Printed
Page 269
top

resonse should be response

Anonymous    Nov 08, 2013
Printed
Page 271
6th line from the bottom

resonse should be response *** p273, Example 10-12, echoResponse() method, near bottom of page, change: self.wfile.write("</xml></font><font face="arial,verdana,helvetica" " size="4">Body:<br><xmp>") to: self.wfile.write('</xml></font><font face="arial,verdana,helvetica"' ' size="4">Body:<br><xmp>') Please maintain current indentation of lines. *** p285, Example 10-15, halfway down the page, change: id = CustProfElement.getAttributeNS('', "id") to: id = CustProfElement.getAttributeNS(None, "id") Please maintain current indentation of line.

Anonymous    Nov 08, 2013
Printed
Page 291
3rd line in 2nd paragraph

their should be there *** p. 294 -- fix the various "__" on this page by inserting hair spaces.

Anonymous    Nov 08, 2013