xmlpp::Validator Class Referenceabstract

Base class for XML validators. More...

`#include <libxml++/validators/validator.h>`

Inheritance diagram for xmlpp::Validator:
[legend]

## Public Member Functions

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

## Protected Member Functions

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

## Static Protected Member Functions

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

std::unique_ptr< exception > | exception_
ustring | validate_error_
ustring | validate_warning_

## Detailed Description

Base class for XML validators.

## Constructor & Destructor Documentation

## Validator()

xmlpp::Validator::Validator | ( |  | ) |

noexcept

## ~Validator()

xmlpp::Validator::~Validator | ( |  | ) |

override

## Member Function Documentation

## callback_error_or_warning()

static void xmlpp::Validator::callback_error_or_warning | ( | bool | error,
|  | void * | ctx,
|  | const char * | msg,
|  | va_list | var_args )

staticprotected

Since libxml++ 5.2

## callback_validity_error()

static void xmlpp::Validator::callback_validity_error | ( | void * | ctx,
|  | const char * | msg,
|  |  | ... )

staticprotected

Deprecated
  Use get_callback_validity_error_cfunc() instead.

## callback_validity_warning()

static void xmlpp::Validator::callback_validity_warning | ( | void * | ctx,
|  | const char * | msg,
|  |  | ... )

staticprotected

Deprecated
  Use get_callback_validity_warning_cfunc() instead.

## check_for_exception()

virtual void xmlpp::Validator::check_for_exception | ( |  | ) |

protectedvirtual

## check_for_validity_messages()

virtual void xmlpp::Validator::check_for_validity_messages | ( |  | ) |

protectedvirtual

## get_callback_validity_error_cfunc()

static ValidatorCallbackCFuncType xmlpp::Validator::get_callback_validity_error_cfunc | ( |  | ) |

staticprotected

Since libxml++ 5.2

## get_callback_validity_warning_cfunc()

static ValidatorCallbackCFuncType xmlpp::Validator::get_callback_validity_warning_cfunc | ( |  | ) |

staticprotected

Since libxml++ 5.2

## handle_exception()

virtual void xmlpp::Validator::handle_exception | ( |  | ) |

protectedvirtual

To be called in an exception handler.

## initialize_context()

virtual void xmlpp::Validator::initialize_context | ( |  | ) |

protectedvirtual

Reimplemented in xmlpp::DtdValidator, xmlpp::RelaxNGValidator, xmlpp::SchemaValidatorBase, and xmlpp::XsdValidator.

## on_validity_error()

virtual void xmlpp::Validator::on_validity_error | ( | const ustring & | message | ) |

protectedvirtual

## on_validity_warning()

virtual void xmlpp::Validator::on_validity_warning | ( | const ustring & | message | ) |

protectedvirtual

## operator bool()

virtual xmlpp::Validator::operator bool | ( |  | ) | const

explicitpure virtualnoexcept

Test whether a schema or a DTD has been parsed.

For instance

if (validator)
do_something();

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

## parse_file()

virtual void xmlpp::Validator::parse_file | ( | const std::string & | filename | ) |

pure virtual

Parse a schema definition file or an external subset (DTD file).

Parameters

  filename | The URL of the schema or the DTD.

Exceptions

  xmlpp::parse_error |

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

## parse_memory()

virtual void xmlpp::Validator::parse_memory | ( | const ustring & | contents | ) |

pure virtual

Parse a schema definition or a DTD from a string.

Parameters

  contents | The schema definition or the DTD as a string.

Exceptions

  xmlpp::parse_error |

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

## release_underlying()

virtual void xmlpp::Validator::release_underlying | ( |  | ) |

protectedvirtual

Reimplemented in xmlpp::DtdValidator, xmlpp::RelaxNGValidator, xmlpp::SchemaValidatorBase, and xmlpp::XsdValidator.

## validate()

virtual void xmlpp::Validator::validate | ( | const Document * | document | ) |

pure virtual

Validate a document, using a previously parsed schema or DTD.

Parameters

  document | Pointer to the document.

Exceptions

  xmlpp::internal_error |
  xmlpp::validity_error |

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

## Member Data Documentation

## exception_

std::unique_ptr<exception> xmlpp::Validator::exception_

protected

## validate_error_

ustring xmlpp::Validator::validate_error_

protected

## validate_warning_

ustring xmlpp::Validator::validate_warning_

protected