Automatic transformation of XML namespaces/Validation
Algorithm[edit | edit source]
Variables[edit | edit source]
The following variables are kept during the validation:
- the set of "entire document" validators used.
Rationale: For a given namespace, run "entire document" validators no more than once.
The loop[edit | edit source]
First, RDF files which are downloaded before main loop are downloaded and processed.
In a loop enumerate all primary nodes (either in XML deep first, or XML breadth first order, dependently on the user option) (Note: If with a primary node there is associated several namespaces, enumerate it several times with different namespaces; order of these namespaces in unspecified by this specification):
- For the namespace associated with the primary node find a validator with maximal priority (which is recommended to be calculated as the product of completeness, stability, and preference).
- If there are no such validators, download the next RDF file.
- If there are also no next RDF file, exit from the loop (if the user option whether presence of unknown namespaces makes the document invalid is true, then consider the document invalid).
- If the chosen validator is not in the list of "entire document" validators:
- If the chosen validator is "entire", add it to the set of "entire document" validators.
- Validate the subdocument (or the entire document, if the validator is "entire").
- Stop and consider the document invalid, if it is invalid.
If the validator has :entire object for :validatorKind predicate, then the entire document is passed to the validator. Validation stops with failure if this validator fails.
If the validator has :parts object for :validatorKind then the subdocument started at our primary node is passed to the validator.
If the document was not considered invalid during the loop, then consider it valid.