Detailed Description

This abstract class provides the interface for all validators.

This is the simple amount of API that all validators must honor, in order for the scanner to use them to do validation. All validators will actually contain much more functionality than is accessible via this common API, but that functionality requires that you know what type of validator you are dealing with.

Basically, at this level, the primary concern is to be able to query core information about elements and attributes. Adding decls to the validator requires that you go through the derived interface because they all have their own decl types. At this level, we can return information via the base decl classes, from which each validator derives its own decl classes.

Constructor & Destructor Documentation

virtual XMLValidator::~XMLValidator

(

)

[virtual]

The derived class should clean up its allocated data, then this class will do the same for data allocated at this level.

Member Function Documentation

The derived class should look up its declaration of the passed element from its element pool.

It should then use the content model description contained in that element declaration to validate that the passed list of child elements are valid for that content model. The count can be zero, indicating no child elements.

Note that whitespace and text content are not validated here. Those are handled by the scanner. So only element ids are provided here.

Parameters:

elemDecl

The element whose content is to be checked.

children

An array of element QName which represent the elements found within the parent element, i.e. the content to be validated.

childCount

The number of elements in the childIds array. It can be zero if the element had none.

It should use the passeed attribute definition (which is passed via the base type so it must often be downcast to the appropriate type for the derived validator class), to fill in the passed attribute. This is done as a performance enhancement since the derived class has more direct access to the information.

virtual void XMLValidator::preContentValidation

(

bool

reuseGrammar,

bool

validateDefAttr = false

)

[pure virtual]

This method is called by the scanner after a Grammar is scanned.

virtual void XMLValidator::postParseValidation

(

)

[pure virtual]

This method is called by the scanner after the parse has completed.

It gives the validator a chance to check certain things that can only be checked after the whole document has been parsed, such as referential integrity of ID/IDREF pairs and so forth. The validator should just issue errors for any problems it finds.

virtual void XMLValidator::reset

(

)

[pure virtual]

This method is called by the scanner before a new document is about to start.

It gives the validator a change to reset itself in preperation for another validation pass.

virtual bool XMLValidator::requiresNamespaces

(

)

const [pure virtual]

The derived class should return a boolean that indicates whether it requires namespace processing or not.

Some do and some allow it to be optional. This flag is used to control whether the client code's requests to disable namespace processing can be honored or not.

Most of the grunt work of loading the text, getting the current source location, ect... is handled here.

If the loaded text has replacement parameters, then text strings can be passed. These will be used to replace the tokens {0}, {1}, {2}, and {3} in the order passed. So text1 will replace {0}, text2 will replace {1}, and so forth.

textX Up to four replacement parameters. They can be provided as either XMLCh strings, or local code page strings which will be transcoded internally.

Parameters:

toEmit

The error code to emit. it must be one of the defined validator error codes.