Wrox Home  
Search

Topic: XML

Beginning XML, 2nd Edition (0764543946) cover image

Beginning XML, 2nd Edition

David Hunter, Kurt Cagle, Chris Dix, Roger Kovack, Jonathan Pinnock, Jeff Rafter
ISBN: 978-0-7645-4394-4
Paperback
900 pages
December 2001
View Most Recent Edition of This Title
This title is out-of-print and not currently available for purchase from this site.


Do you think you've discovered an error in this book? Please check the list of errata below to see if we've already addressed the error. If not, please submit the error via our Errata Form. We will attempt to verify your error; if you're right, we will post a correction below.

ChapterPageDetailsDatePrint Run
42 Adding Attributes to Als CD

In this example, the code and the screenshot do not agree. Single quotes are used around the values of the attributes we are asked to add in the code but double quotes appear in the screenshot. As either single or double quotes are acceptable for attributes, either can be used but IE will display whichever you use in the code ordinarily.

Also, the How It Works for this example on Page 43 describes adding the first attribute without quotes and then receiving an error message in IE as the parser finds this error - this step is not described in the Try It Out section.

Thanks to Howard for spotting this.

07-Jan-02 1
49 Incorrect Screenshot

The screenshot on page 49 is incorrect and does not represent how the file cd4.xml will look when viewed with Internet Explorer 5 or later. It is the one on page 47 repeated.

The correct screenshot (named cd4xml.jpg) is available within the code download for this book.

It shows the inclusion of the and elements.

Thanks to Silhone Sung

27-Feb-02 1
84 Unseen members of namespaces list

At the top of page 84 we give a list of namespaces and introduce them as having been seen before in the chapter. In fact, only the pers namespace has been seen before.

The text surrounding the list can be reworded to read:

Imagine we choose to create three namespaces for Serna Ferna Inc:

  • http//sernaferna.com/pers
  • http://sernaferna.com/locator
  • http://sernaferna.com/name

We could instead create one namespace which the company would use for all of its XML document types. Or, conversely, we could break down or namespaces down further, perhaps splitting the <person> document type into multiple namespaces. Why did we choose three?

02-May-02 1
4 88 Incorrect URL for the Java Version of Xalan

The correct URL for the download of Xalan for Java is:

http://xml.apache.org/xalan-j/index.html

Thanks to Shannon Bain for spotting this.

20-Dec-02 1
94 "given" should be "quantity"

The second paragraph on page 94 incorrectly states that the template shown on page 93 will be applied for any elements named "given". In fact it should be "quantity".

The sentence should read:

In this case, the template will be applied for any elements.

15-Jan-02 1
94 Incorrect example

The explanation of the example given to illustrate the use of the <xsl:value-of> element does not agree with the example code. The code uses the <quantity> element, whereas the explanation uses <first>.

The correct explanation should read:

In other words, if the XSLT engine finds:

<quantity>16</quantity>

it will output 16, and if it finds:

<quantity>121</quantity>

it will output 121

25-Apr-02
94 Incorrect backwards reference to CSS

In the 'Associating Stylesheets with XML Documents Using Processing Instructions' section, there is an erroneous backwards reference to CSS. At this stage in the book we haven't covered this in detail (please see Chapter 11 where this discussion does take place).

The sentence that begins 'However, an XSL stylesheet...' should read:

However, an XSL stylesheet can also be associated with an XML document using a processing instruction, like this:

25-Apr-02 1
4 104 Incorrect font used

The formatting of the last 2 words on the page should have been the other way around. At present, the word axis is formatted to indicate that it is the name of an axis when, in fact, the name of the axis is attribute.

Thanks to Jeff Wofford for pointing this out.

20-Dec-02 1
111 Missing closing slashes

In both code fragments in the <xsl:apply-templates> section of the page, the <xsl:apply-templates> elements are missing the closing slash required to make the fragments well formed XML.

In the first fragment, the element should read:

<xsl:apply-templates/>

and in the second fragment, the element should read:

<xsl:apply-templates select="item"/>

10-May-02 1
4 127 Header missing from ElemsToAtts.xsl

The line is missing from the top of the ElemsToAtts.xsl stylesheet created in stage 4 of the Try It Out example.

Although the stylesheet will still work in MSXSL, it is important to note that it may not work elsewhere as the omission of this line makes the it not well formed.

Thanks to Jeff Wooford for spotting this.

20-Dec-02 1
131 Location of order.xml code

The code for order.xml is shown on pages 99-100, but it's easy to miss as it's not used in any Try It Out example until we get to this page.
Also, when you run the example on page 131 with order.xml, you'll notice that there are some errors on the page. The command to run the example should be

>msxsl order.xml defaulttemplates.xsl

in both cases, rather than

>msxsl order.xml defaults.xsl

When you run the code the first time, the resulting output will include Company A, rather than Customer A, as this is the data contained in order.xml.

When you run the code the second time, the resulting output will include Customer: Company A, rather than Customer: Customer A, as this is the data contained in order.xml.

27-Jun-02 1
132 Try It Out - Default Template Gotchas

n step 3, the command to run the file should be:

>msxsl order.xml defaulttemplates.xsl

and the results should show:

Company A rather than Customer A

In step 4, the command to run the file should be:

>msxsl order.xml defaulttemplates.xsl

and the results should show:

Customer: Company A rather than Customer: Customer A

10-May-02 1
134 Erroneous element in code

The code for the <xsl:choose> example does not match the text. The code shows the use of the <salary> element rather than the <number> element discussed.

The code should read:

<xsl:choose>
<xsl:when text=number[number(.)...
<xsl:when text=number[number(.)...
</xsl:choose>

Thanks to Marianne Hazlewood for spotting this.

28-Oct-02 1
4 140 Wrong function name in stylesheet

On page 123 the stylesheet AttsToElems.xsl is shown. This stylesheet is reshown on page 140, however there is a difference. In the last template of the stylesheet on page 123 the local-name() function is used, but in the last template of the same stylesheet on page 140 the name() function is used. This should still work but the name should not have changed from page 123. Thanks to Michael O' Sullivan for bringing this to our attention

06-Jan-03 1
194 Incorrect NMTOKENS example

The first line of code on page 194 should read:

<!ATTLIST catalog type NMTOKENS #IMPLIED>

not

<!ATTLIST catalog type NMTOKEN #IMPLIED>


Thanks to Don Foster

21-Dec-01 1
260 Incorrect example for date datatype

The value 05-07-1995 has been given as a valid example of date datatype value.

This is incorrect because the date datatype uses the format CCYY-MM-DD. The correct example should be 1995-05-07

Thanks to Matt Howell

29-Oct-02 1
278 Extending simpleType Definitions

The second of the examples showing valid code according to the element declaration earlier in the page contains an error - the attribute name, gender, is missing.

It reads: <artist ="male">"Weird Al" Yankovic</artist>

But it should read:

<artist gender="male">"Weird Al" Yankovic</artist>

12-Feb-02 1
7 293 Incorrect Namespace Prefix

Page 293 shows the following code snippet: <artist title="Mr"> <name:first>Alfred</name:first> <name:middle>middle</name:middle> <name:last>Yankovic</name:last> </artist> The namespace prefix of name: used here is incorrect. This namespace prefix is declared in the root element of the instance document as n: and not name: so this code snippet should be: <artist title="Mr"> <n:first>Alfred</n:first> <n:middle>middle</n:middle> <n:last>Yankovic</n:last> </artist> Note that this also means the very last sentence at the bottom of the page needs the reference to the 'name' prefix changed to n. In other words this last sentence should read: 'therefore we must qualify them with the n prefix we declared in the root element of our instance document'. Thank you Michael O' Sullivan for bringing this to our attention.

04-Mar-03 1
324 Incorrect Screenshot

Unfortunately the first screenshot on this page is a repeat of the second one.

The first screenshot should show the text DemoElement rather than null.

20-Feb-02 1
353 Minimal Parsing Using Sax

In the Try It Out section beginning on page 352 the java listing in step 2 fails to include the statement:

import org.xml.sax.helpers.XMLReaderFactory;

This results in a compile time error. This is corrected in the full listing that follows on page 354 - 355 and in the bandreader.java file available from the code download.

In step 4 a semi-colon is missing from the end of the statement:

XMLReader readerObj = XMLReaderFactory.createXMLReader ("org.apache.xerces.parsers.SAXParser")

This results in a compile time error. This is also corrected in the full listing that follows on page 354 - 355 and in bandreader.java available in the code download.

Thanks to Nat Thompson for pointing out these omissions.

08-Jan-02 1
441 em should be i

The second code block on the page does not correspond with the first. It shows the use of em in a container relationship, instead of i . The code should read:

<style>
h1 i {color:red}
</style>

Also, the reference to <em> in the following sentence should be to <i>.

10-Jun-02 1
476 Incorrect field name in diagram

In the first diagram on the page, which shows the CorporateCustomer table, the third field name is incorrect.

The diagram shows company_name, but should show company_address.

15-May-02 2
552 Running the Address Book Application and Tomcat 4.0.2

Unfortunately, the latest release of Tomcat, Tomcat 4.0.2, has changed XML parsing capabilities and class loading methods from the release that was current at the time the book was written. This means that if you have Tomcat 4.0.2 you will need to carry out some extra steps in order to run the address book application sucessfully (this is because the code was designed to run with an earlier version).

If you don't carry out the extra steps, you will recieve internal server errors when trying to run the application.

You will need to:

*Install Tomcat as instructed in the book, including setting the JAVA_HOME environment variable.
*Copy the xsl.war file to the webapps directory, as instructed in the book.
*Start Tomcat to enable unpacking of the .war file.
*Stop Tomcat.
*Within the Tomcat files, move xerces.jar from common/lib to server/lib (i.e. there shouldn't be a copy of xerces.jar in common/lib anymore and there should be one in server/lib).
*Within the case study application files move crimson.jar and saxon.jar from xsl/WEB_INF/lib to common/lib in the Tomcat files (i.e. there shouldn't be copies of crimson.jar and saxon.jar in xsl/WEB_INF/lib anymore and there should be copies of them in common/lib).
*Start Tomcat again.
*Type http://localhost:8080/xsl/xslapp into your browser and the application should start fine.

19-Feb-02 1
Printer-Ready Version   Share This
With you wherever you go: pdf + ePub + kindle -- DRM-free