Automatic transformation of XML namespaces/Validation

Algorithm edit

Variables edit

The following variables are kept during the validation:

  1. the set of "entire document" validators used.

Rationale: For a given namespace, run "entire document" validators no more than once.

The loop edit

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):

  1. 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).
  2. If there are no such validators, download the next RDF file.
  3. 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).
  4. If the chosen validator is not in the list of "entire document" validators:
    1. If the chosen validator is "entire", add it to the set of "entire document" validators.
    2. Validate the subdocument (or the entire document, if the validator is "entire").
    3. 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.