Tracking a standard under development is difficult work. Despite the best efforts by myself and many reviewers, some "bugs" inevitably slip through. This page lists known errors in the text, which is based on the November, 2003 XQuery drafts that were current at the time the book was written. If you find additional errors not listed here, please email them to me at xquery@qbrundage.com and I will correct them here.
Special thanks to John Linderman for going through the book with a fine-toothed comb and reporting many errors. Thanks also to the following readers who reported corrections: Teemu Keiski, Dare Obasanjo, Michael Rys, and Clemens Syzerperski.
Corrections to the First Edition, first printing
Chapter 1
p.12, Figure 1.1: document()
should be document-node()
.
p.13, section 1.6.3, paragraph 1, the word order is wrong. It should read "Table 1.1 lists the 36 XQuery types from XML Schema that you don't need."
Chapter 2
p. 46, next-to-last paragraph, first sentence: "(1GB)" should be "(4GB)".
p. 51, first paragraph, first sentence: get-namespace-from-QName
should be get-namespace-uri-from-QName
. (The corresponding Listing is correct.)
p. 57, Listing 2.12: The data()
expression is missing a closing parenthesis.
Chapter 3
p. 73, Table 3.3: There's an extra hyphen in the first row. Should be get-in-scope-prefixes()
.
p. 76, Listing 3.6: The a:assigned-to
attribute should be a:assigned
(both places it occurs)
p. 83, the paragraph after Listing 3.19: urn:namespace1
should be urn:one
and urn:namespace2
should be urn:two
.
p. 84, section 3.6.2, second paragraph: the expression contains an extra }
, it should be:
<x>{doc("y.xml")//y}</x>
p. 86, third paragraph, last sentence: there's a missing space character between the author's name and "is". It should read "...Margin Gudgin is..."
Chapter 5
p. 99, Listing 5.4: third example (2 eq 1E0
) should result in false.
p. 106, Table 5.2: the description of reverse
is incorrect. It should read "Reverse a sequence".
p. 113, Listing 5.23: the example 3 mod 2.2
should result in 0.8
, not 3.0
p. 114, the paragraph after Listing 5.25: The descriptions of floor()
and ceiling()
are
missing the important phrase "or equal to". These two sentences should read as follows: "The floor()
function takes a number and returns the greatest integer less than or equal to it (rounding down towards
negative infinity). The ceiling()
function returns the least integer greater than or equal to its
argument (rounding up toward positive infinity)." [emphasis added]
p. 120, Table 5.6: As noted below, there's an additional builtin prefix
local
bound to the namespace http://www.w3.org/2003/11/xquery-local-functions
p. 127, first paragraph: The second sentence is missing an opening parenthesis. It should read "(like in SQL)".
Chapter 6
p. 142, last paragraph: The example is incorrect, it should be for $a in $seq1, $b in $seq2 where $a > $b return $a
.
Chapter 9
p. 191, Listing 9.15: The last two examples are missing the xs
prefix;
xsi:type="anyType"
should be xsi:type="xs:anyType"
in both places.
Updates to the XQuery standard
local functions
One change in the November drafts that I missed during final editing is the addition of a new
builtin namespace prefix, local
, which is bound to the namespace uri
http://www.w3.org/2003/11/xquery-local-functions
. All user-defined functions are now required
to belong to some namespace, and the natural choice is to use the predefined local
namespace. If your
XQuery implementation enforces this rule, then you will need to write, for example,
declare function local:foo() { ... }
instead of just declare function foo() { ... }
.
xdt:untypedAny
The November drafts added a new complex type, xdt:untypedAny
, that we didn't have
time to include in the book. This type is mainly important for implementers and the XQuery formal semantics.
It's likely that its behavior (and quite possibly its name) will change in the next XQuery draft.
For now, xdt:untypedAny
is the type given to elements from schemaless ("untyped") XML,
elements that have been validated in skip
mode, and elements typed by an XML Schema as
xs:anyType
. The xdt:untypedAny
type is a concrete type "derived" from
xs:anyType
, and denotes that the element may have any content (including mixed content).
An element typed as xdt:untypedAny
has a typed value (returned by data()
)
whose type is xdt:untypedAtomic
.
You'll mainly work with the xdt:untypedAtomic
type, which is fully explained in the book.