#include <SchemaValidator.h>
An SchemaValidator
represents factory for validating instance documents against a schema.
◆ SchemaValidator() [1/2]
SchemaValidator::SchemaValidator |
( |
| ) |
|
Default constructor.
Creates Schema Validator
◆ SchemaValidator() [2/2]
SchemaValidator::SchemaValidator |
( |
SaxonProcessor * |
proc, |
|
|
std::string |
cwd = "" |
|
) |
| |
A constructor with a SaxonProcessor.
The supplied processor should have license flag set to true for the Schema Validator to operate.
- Parameters
-
◆ checkException()
const char * SchemaValidator::checkException |
( |
| ) |
|
Check for exception thrown.
- Returns
- char*. Returns the main exception message if thrown otherwise return NULL
◆ clearParameters()
void SchemaValidator::clearParameters |
( |
bool |
deleteValues = false | ) |
|
Clear parameter values set
- Parameters
-
deleteValues. | Individual pointers to XdmValue objects have to be deleted in the calling program Default behaviour (false) is to leave XdmValues in memory true then XdmValues are deleted |
◆ clearProperties()
void SchemaValidator::clearProperties |
( |
| ) |
|
Clear property values set
◆ exceptionCount()
int SchemaValidator::exceptionCount |
( |
| ) |
|
Get number of errors during validation of the source against the schema.
- Returns
- int - Count of the exceptions reported during validation
◆ exceptionOccurred()
bool SchemaValidator::exceptionOccurred |
( |
| ) |
|
Checks for pending exceptions without creating a local reference to the exception object
- Returns
- bool - true when there is a pending exception; otherwise return false
◆ getErrorCode()
const char * SchemaValidator::getErrorCode |
( |
int |
i | ) |
|
Get the i'th error code if there are any error.
Validation error are reported as exceptions. All errors can be retrieved.
- Returns
- char* - The error code of the i'th exception.
◆ getErrorMessage()
const char * SchemaValidator::getErrorMessage |
( |
int |
i | ) |
|
Get the ith error message if there are any validation errors.
May have a number of validation errors reported against it the source.
- Returns
- char* - The message of the i'th exception
◆ getParameters()
std::map< std::string, XdmValue * > & SchemaValidator::getParameters |
( |
| ) |
|
Get all parameters as a std::map
◆ getProperties()
std::map< std::string, std::string > & SchemaValidator::getProperties |
( |
| ) |
|
Get all properties as a std::map
◆ getValidationReport()
XdmNode * SchemaValidator::getValidationReport |
( |
| ) |
|
Get the Validation report.
The valdiation-report option must have been set to true in the properties to use this feature.
- Returns
- XdmNode - Pointer to XdmNode. Return NULL if validation reporting feature has not been enabled
◆ registerSchemaFromFile()
void SchemaValidator::registerSchemaFromFile |
( |
const char * |
xsd | ) |
|
Register the schema from file name.
Set the current working directory for the Schema Validator
- Parameters
-
xsd | - File name of the schema relative to the cwd |
◆ removeParameter()
bool SchemaValidator::removeParameter |
( |
const char * |
name | ) |
|
Remove a parameter (name, value) pair
- Parameters
-
- Returns
- bool - outcome of the romoval
◆ setcwd()
void SchemaValidator::setcwd |
( |
const char * |
cwd | ) |
|
Set the Current working Directory.
Set the current working directory for the Schema Validator
- Parameters
-
cwd | Supplied working directory which replaces any set cwd. Ignore if cwd is NULL. |
◆ setLax()
void SchemaValidator::setLax |
( |
bool |
l | ) |
|
|
inline |
The validation mode may be either strict or lax.
The default is strict; this method may be called to indicate that lax validation is required. With strict validation, validation fails if no element declaration can be located for the outermost element. With lax validation, the absence of an element declaration results in the content being considered valid.
- Parameters
-
lax | true if validation is to be lax, false if it is to be strict |
◆ setOutputFile()
void SchemaValidator::setOutputFile |
( |
const char * |
outputFile | ) |
|
Set the name of the output file that will be used by the validator.
- Parameters
-
outputFile | the output file name for later use |
◆ setParameter()
void SchemaValidator::setParameter |
( |
const char * |
name, |
|
|
XdmValue * |
value |
|
) |
| |
Set a parameter value used in the validator s
- Parameters
-
name | of the parameter, as a string. For namespaced parameter use the JAXP solution i.e. "{uri}name" |
value | of the query parameter, or null to clear a previously set value |
◆ setProperty()
void SchemaValidator::setProperty |
( |
const char * |
name, |
|
|
const char * |
value |
|
) |
| |
Set a property.
- Parameters
-
name | of the property |
value | of the property |
◆ setSourceNode()
void SchemaValidator::setSourceNode |
( |
XdmNode * |
source | ) |
|
Set the source node for validation.
- Parameters
-
The | name of the file to be validated. Default is NULL |
- Returns
- Result of the validation stored and returned as an XdmNode object
◆ validate()
void SchemaValidator::validate |
( |
const char * |
sourceFile = NULL | ) |
|
Validate an instance document by a registered schema.
- Parameters
-
sourceFile | Name of the file to be validated. Allow null when source document is supplied with other method |
◆ validateToNode()
XdmNode * SchemaValidator::validateToNode |
( |
const char * |
sourceFile = NULL | ) |
|
Validate an instance document supplied as a Source object.
- Parameters
-
sourceFile | The name of the file to be validated. Default is NULL |
- Returns
- XdmNode - the validated document returned to the calling program
The documentation for this class was generated from the following files: