Skip to content
angelozerr edited this page Mar 18, 2013 · 11 revisions

Syntax Errors

Features

CodeMirror provides the lint feature to display syntax errors. CodeMirror-XQuery uses this feature to implement a remoting lint (the XQuery is validated on server side which is called with an Ajax request (jQuery)).

When errors occurs, they appear like this :

SyntaxError1

To know the detail of the error, go on the error gutter and tooltip appears with the error message :

SyntaxError2

CodeMirror-XQuery hosts the statusline addon to display the number of errors. If you click on this status, it select the code where there is the first error :

SyntaxError3

When there are none errors, status displays a green icon :

SyntaxError4

How it works?

Because it exists a lot of XQuery processor which implements XQuery by adding some build-in, the syntax errors must to do on server side with the well XQuery processor implmentation.

For instance, the demo uses Saxon to compile the XQuery content comming from the editor and returns a JSON array with the errors. Each time you type content in the editor, an Ajax request is created (with timeout) to collect from the server side the errors.

So the XML Databases (MarkLogic, Zorba, etc) which wish to implement the syntax errors, must create a service which parse an xquery and returns a JSON array with the errors.

Clone this wiki locally