Building a parse tree representation of an XQuery or XPath query is an important first step in responding to that query. This presentation shows how to use the JavaCC parser generator tool, starting from the XQuery BNF, to build a parse tree for a particular XQuery instance, and how to tailor that tree to make it easily walkable at query-resolution time to connect in to your own backend data structures. JavaCC is used by both the W3C’s Query Working Group to test new versions of the XQuery grammar, and by the author to generate the query-parsing code in Fatdog’s opensource query engine product.
| XML Source | PDF (for print) | Author Package | Typeset PDF |
But see the author package.