libxml++  5.4.0
Public Member Functions | Protected Member Functions | List of all members
xmlpp::SchemaValidatorBase Class Referenceabstract

Base class for schema validators. More...

#include <libxml++/validators/schemavalidatorbase.h>

Inheritance diagram for xmlpp::SchemaValidatorBase:
Inheritance graph
[legend]

Public Member Functions

 SchemaValidatorBase () noexcept
 
 ~SchemaValidatorBase () override
 
 operator bool () const noexcept override=0
 Test whether a schema has been parsed. More...
 
virtual void parse_document (const Document * document)=0
 Parse a schema definition from a document. More...
 
void parse_file (const std::string & filename) override=0
 Parse a schema definition file. More...
 
void parse_memory (const ustring & contents) override=0
 Parse a schema definition from a string. More...
 
void validate (const Document * document) override=0
 Validate a document, using a previously parsed schema. More...
 
virtual void validate (const std::string & filename)=0
 Validate an XML file, using a previously parsed schema. More...
 
- Public Member Functions inherited from xmlpp::Validator
 Validator () noexcept
 
 ~Validator () override
 
- Public Member Functions inherited from xmlpp::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
 NonCopyable (NonCopyable &&)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
NonCopyableoperator= (NonCopyable &&)=delete
 

Protected Member Functions

void initialize_context () override
 
void release_underlying () override
 
- Protected Member Functions inherited from xmlpp::Validator
virtual void check_for_exception ()
 
virtual void check_for_validity_messages ()
 
virtual void handle_exception ()
 To be called in an exception handler. More...
 
virtual void on_validity_error (const ustring & message)
 
virtual void on_validity_warning (const ustring & message)
 
- Protected Member Functions inherited from xmlpp::NonCopyable
 NonCopyable () noexcept
 
virtual ~NonCopyable ()
 

Additional Inherited Members

- Static Protected Member Functions inherited from xmlpp::Validator
static void callback_error_or_warning (bool error, void * ctx, const char * msg, va_list var_args)
 
static void callback_validity_error (void * ctx, const char * msg,...)
 
static void callback_validity_warning (void * ctx, const char * msg,...)
 
static ValidatorCallbackCFuncType get_callback_validity_error_cfunc ()
 
static ValidatorCallbackCFuncType get_callback_validity_warning_cfunc ()
 
- Protected Attributes inherited from xmlpp::Validator
std::unique_ptr< exceptionexception_
 
ustring validate_error_
 
ustring validate_warning_
 

Detailed Description

Base class for schema validators.

Since libxml++ 2.38:

Constructor & Destructor Documentation

◆ SchemaValidatorBase()

xmlpp::SchemaValidatorBase::SchemaValidatorBase ( )
noexcept

◆ ~SchemaValidatorBase()

xmlpp::SchemaValidatorBase::~SchemaValidatorBase ( )
override

Member Function Documentation

◆ initialize_context()

void xmlpp::SchemaValidatorBase::initialize_context ( )
overrideprotectedvirtual

Reimplemented from xmlpp::Validator.

Reimplemented in xmlpp::XsdValidator.

◆ operator bool()

xmlpp::SchemaValidatorBase::operator bool ( ) const
explicitoverridepure virtualnoexcept

Test whether a schema has been parsed.

For instance

if (validator)
do_something();

Implements xmlpp::Validator.

Implemented in xmlpp::XsdValidator, and xmlpp::RelaxNGValidator.

◆ parse_document()

virtual void xmlpp::SchemaValidatorBase::parse_document ( const Document document)
pure virtual

Parse a schema definition from a document.

If the validator already contains a schema, that schema is released (deleted if the validator owns the schema).

Parameters
documentA preparsed document tree, containing the schema definition.
Exceptions
xmlpp::parse_error

Implemented in xmlpp::XsdValidator, and xmlpp::RelaxNGValidator.

◆ parse_file()

void xmlpp::SchemaValidatorBase::parse_file ( const std::string filename)
overridepure virtual

Parse a schema definition file.

If the validator already contains a schema, that schema is released (deleted if the validator owns the schema).

Parameters
filenameThe URL of the schema.
Exceptions
xmlpp::parse_error

Implements xmlpp::Validator.

Implemented in xmlpp::XsdValidator, and xmlpp::RelaxNGValidator.

◆ parse_memory()

void xmlpp::SchemaValidatorBase::parse_memory ( const ustring contents)
overridepure virtual

Parse a schema definition from a string.

If the validator already contains a schema, that schema is released (deleted if the validator owns the schema).

Parameters
contentsThe schema definition as a string.
Exceptions
xmlpp::parse_error

Implements xmlpp::Validator.

Implemented in xmlpp::XsdValidator, and xmlpp::RelaxNGValidator.

◆ release_underlying()

void xmlpp::SchemaValidatorBase::release_underlying ( )
overrideprotectedvirtual

Reimplemented from xmlpp::Validator.

Reimplemented in xmlpp::XsdValidator.

◆ validate() [1/2]

void xmlpp::SchemaValidatorBase::validate ( const Document document)
overridepure virtual

Validate a document, using a previously parsed schema.

Parameters
documentPointer to the document.
Exceptions
xmlpp::internal_error
xmlpp::validity_error

Implements xmlpp::Validator.

Implemented in xmlpp::XsdValidator, and xmlpp::RelaxNGValidator.

◆ validate() [2/2]

virtual void xmlpp::SchemaValidatorBase::validate ( const std::string filename)
pure virtual

Validate an XML file, using a previously parsed schema.

Parameters
filenameThe URL of the XML file.
Exceptions
xmlpp::internal_error
xmlpp::parse_error
xmlpp::validity_error

Implemented in xmlpp::XsdValidator, and xmlpp::RelaxNGValidator.