Database Reference
In-Depth Information
• If the $grammar URI ends with .xml it is assumed to be an OASIS catalog file,
which is used to further determine the grammar document.
• If the $grammar URI ends with a / , it is assumed to be the name of a collec‐
tion. eXist will search for an appropriate grammar in that collection and its
subcollections.
The report returned by validation:validate-report for a valid document will look
like this:
<report>
<status> valid </status>
<namespace> http://myapp.com/namespace </namespace>
<duration unit= "msec" > 51 </duration>
</report>
For an invalid document, it will contain one or more error messages. For example:
<report>
<status> invalid </status>
<namespace> http://myapp.com/namespace </namespace>
<duration unit= "msec" > 6 </duration>
<message level= "Error" line= "10" column= "29" >
cvc-complex-type.2.4.a: Invalid content was found ...
</message>
</report>
Grammar management in the JAXP (Xerces) parser
This applies to the JAXP (Xerces) parser type only: to speed up validation, grammar
documents are loaded, compiled, and held in the cache. This is usually fine, but there
might be situations where you want a little bit more control over this (for instance,
when you're developing grammars).
eXist provides the following XQuery functions for working with the grammar cache:
validation:clear-grammar-cache
Clears the grammar cache and returns the number of deleted grammars
validation:pre-parse-grammar
Parses one or more XML schema documents or DTDs and adds them to the
grammar cache
validation:show-grammar-cache
Returns an XML fragment describing the contents of the grammar cache
Search WWH ::




Custom Search