Use these Java applets to check your syntax online, or as the basis for your own XPath 2 or XQuery implementation. They support XML Query, XPath 2, and also the Full Text and Update drafts.
The applets are a tool for readers and parser implementers of XPath 2.0 and 2.1, and XQuery 1.0 and 1.1. The results should not be used as an absolute reference, and may flag legal syntax or errors not intended by the drafts. However, the applets were generated by processing the XML representation of the grammar, which is also used to produce the EBNF productions in the XPath and XQuery drafts. This parser is also used by the working groups to validate the integrity of the grammar. Implementers may wish to download the XPath 2/XQuery Parser Build, xgrammar_src.zip and xgrammar_libs.zip, if they are interested in the parser production, and more details of this process.