Database Reference
In-Depth Information
Validation
Validation involves checking an XML document against a grammar document, like a
DTD (document type definition) or an XML schema, and determining whether it
conforms to this grammar. eXist can validate documents in two ways:
Implicit validation
Validates an XML document when it is stored into the database. Any parsing
error stops the document from being stored.
Explicit validation
Validates documents from within XQuery code, using the validation extension
module.
Implicit Validation
Implicit validation is (if turned on) performed when a document is being stored into
the database. eXist will search for an appropriate grammar document, validate the
incoming XML document against it, and reject or accept the incoming document
based on the validation results. You can turn implicit validation on or off for the full
database or specific collections.
Implicit validation is useful when you want to make absolutely sure that all the stored
content is valid. However, some interesting limitations apply:
• Implicit validation can only be performed using XML schemas or DTDs, and not
for instance with RELAX NG.
• The catalogs used for finding the grammar documents are globally defined for
the entire database. There is no way to use a specific catalog for a particular col‐
lection or application.
• You cannot specify that a certain collection should only accept documents vali‐
dating against a specific grammar. The only thing you can specify is that the
documents must be valid according to the global set of grammar documents
available in the catalog. So, a scenario forcing a collection to hold, for instance,
only DocBook files is not possible with this mechanism.
This makes implicit validation a somewhat coarse-grained mechanism. However,
there are use cases where it can help make your application more robust, for instance,
when your database is serving a single application and all data files must validate
against a specific set of XML schemas or DTDs.
Search WWH ::




Custom Search