One aspect of this processing approach is that syntax errors can lurk undetected in a branch of code that is not reached, by analogy with interpreted languages such as Python. For example rules or assertions can have incorrect syntax in their context
or test
attribute, for example:
<sch:rule context="/.."> <sch:report test="???">[...]</sch:report> </sch:rule>
One remedy would be for XQS to do some static analysis ahead of time, by parsing these expressions to see if they are valid XQuery; BaseX provides xquery:parse()
, which could be used for this purpose.
One potential drawback of the dynamic evaluation approach worth mentioning if deployed to validate documents in a BaseX database is that xquery:eval()
imposes a global read lock.[42] If this is an issue for a given workflow, it would be advisable to use a compiled schema instead.