Reading the Syntax Diagrams

This book includes syntax diagrams as an option for readers who want a more visual representation of XQuery expression syntax. Each syntax diagram is accompanied by explanatory text and examples. Figure P-1 illustrates the components of a syntax diagram, showing the schema import syntax as an example.

Example syntax diagram

Figure P-1. Example syntax diagram

Rules for interpreting the syntax diagrams are:

  • Parts of the diagram in constant width font are literal values. In Figure P-1, import schema and at should appear literally in your query.

  • Quotes that appear in syntax diagrams also must appear in your query. Figure P-1 shows that the < namespace-name > must be surrounded by quotes, whereas the < prefix > must not. Either single or double quotes can be used in XQuery, but only double quotes are included in the diagrams for simplicity.

  • Where you can specify a value, such as a name, a descriptive name for that value appears in constant width italic and is surrounded by angle brackets. Figure P-1 shows that you fill in the < namespace-name >, < prefix >, and < location > with your own values.

  • Multiple options are indicated by parallel lines in the diagram. Figure P-1 shows that you may choose to specify a namespace prefix or default element namespace.

  • Optional parts of the expression are indicated by an arrow that bypasses the main arrow. In Figure P-1, it is not necessary to include the namespace < prefix > = or the default element namespace keywords.

  • Repeating parts of an expression are indicated by an arrow that returns to the beginning. Figure P-1 shows that you can specify multiple < location >s (preceded by commas) as part of the at clause.

Get XQuery 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.