Path Expressions

We saw earlier in the chapter many examples of path expressions. Here are some more:

$auction/articles has type element(articles)
$auction/articles/article has type element(article)+
$auction/itesm/article is a static type error
					

These assume that $auction has type element(auction) as defined in Listing 4.2. The first expression has type element(articles) because there is exactly one articles element in an auction element. The second expression has type element(article)+ because there are one or more article elements in an articles element. The third expression is a static type error, because there is no itesm element in an auction element. Here is how the error is caught: the type rules assign to the last path expression the ...

Get XQuery from the Experts: A Guide to the W3C XML Query Language now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.