Appendix C

Grammars

C.1 Introduction

In this appendix, we provide the grammar of SQL/XML and of XQuery. Both are presented in a variation of Backus-Naur Form (BNF) and both of these variations are called “extended BNF” (which XQuery calls EBNF). In each section, we summarize the meanings of the notations used in the grammar. We do not present the grammar for XPath 2.0, largely because it is a subset of the XQuery grammar.

C.2 XQuery Grammar

The XQuery grammar1 (which is used by all W3C specifications) involves a variation of EBNF that uses a notation derived from regular expressions. For example, in the XQuery grammar, the BNF nonterminal symbol digits is defined to be any sequence of one or more instances of the characters 0, 1, 2, 3, 4, ...

Get Querying XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.