libxml++ 5.0.2
|
XML DTD validator. More...
#include <libxml++/validators/dtdvalidator.h>
Public Member Functions | |
LIBXMLPP_API | DtdValidator () |
LIBXMLPP_API | DtdValidator (const std::string & filename) |
Create a validator and parse an external subset (DTD file) immediately. More... | |
LIBXMLPP_API | DtdValidator (const ustring & external, const ustring & system) |
Create a validator and parse an external subset (DTD file) immediately. More... | |
LIBXMLPP_API | DtdValidator (Dtd * dtd, bool take_ownership) |
Create a validator. More... | |
LIBXMLPP_API | ~DtdValidator () override |
LIBXMLPP_API const Dtd * | get_dtd () const noexcept |
Get the parsed DTD. More... | |
LIBXMLPP_API Dtd * | get_dtd () noexcept |
Get the parsed DTD. More... | |
LIBXMLPP_API | operator bool () const noexcept override |
Test whether a DTD has been parsed. More... | |
LIBXMLPP_API void | parse_file (const std::string & filename) override |
Parse an external subset (DTD file). More... | |
LIBXMLPP_API void | parse_memory (const ustring & contents) override |
Parse a DTD from a string. More... | |
LIBXMLPP_API void | parse_stream (std::istream & in) |
Parse a DTD from a stream. More... | |
LIBXMLPP_API void | parse_subset (const ustring & external, const ustring & system) |
Parse an external subset (DTD file). More... | |
LIBXMLPP_API void | set_dtd (Dtd * dtd, bool take_ownership) |
Set a DTD. More... | |
LIBXMLPP_API void | validate (const Document * document) override |
Validate a document, using a previously parsed DTD. More... | |
![]() | |
LIBXMLPP_API | Validator () noexcept |
LIBXMLPP_API | ~Validator () override |
virtual LIBXMLPP_API | operator bool () const noexcept=0 |
Test whether a schema or a DTD has been parsed. More... | |
virtual LIBXMLPP_API void | parse_file (const std::string & filename)=0 |
Parse a schema definition file or an external subset (DTD file). More... | |
virtual LIBXMLPP_API void | parse_memory (const ustring & contents)=0 |
Parse a schema definition or a DTD from a string. More... | |
virtual LIBXMLPP_API void | validate (const Document * document)=0 |
Validate a document, using a previously parsed schema or DTD. More... | |
![]() | |
NonCopyable (const NonCopyable &)=delete | |
NonCopyable (NonCopyable &&)=delete | |
NonCopyable & | operator= (const NonCopyable &)=delete |
NonCopyable & | operator= (NonCopyable &&)=delete |
Protected Member Functions | |
LIBXMLPP_API void | initialize_context () override |
LIBXMLPP_API void | release_underlying () override |
![]() | |
virtual LIBXMLPP_API void | check_for_exception () |
virtual LIBXMLPP_API void | check_for_validity_messages () |
virtual LIBXMLPP_API void | handle_exception () |
To be called in an exception handler. More... | |
virtual LIBXMLPP_API void | initialize_context () |
virtual LIBXMLPP_API void | on_validity_error (const ustring & message) |
virtual LIBXMLPP_API void | on_validity_warning (const ustring & message) |
virtual LIBXMLPP_API void | release_underlying () |
![]() | |
NonCopyable () noexcept | |
virtual | ~NonCopyable () |
Additional Inherited Members | |
![]() | |
static LIBXMLPP_API void | callback_validity_error (void * ctx, const char * msg,...) |
static LIBXMLPP_API void | callback_validity_warning (void * ctx, const char * msg,...) |
![]() | |
std::unique_ptr< exception > | exception_ |
ustring | validate_error_ |
ustring | validate_warning_ |
XML DTD validator.
DTD = Document Type Definition
LIBXMLPP_API xmlpp::DtdValidator::DtdValidator | ( | ) |
|
explicit |
Create a validator and parse an external subset (DTD file) immediately.
filename | The URL of the DTD. |
xmlpp::parse_error |
|
explicit |
Create a validator and parse an external subset (DTD file) immediately.
external | The external ID of the DTD. |
system | The URL of the DTD. |
xmlpp::parse_error |
|
explicit |
Create a validator.
dtd | A pointer to the DTD to use when validating XML documents. |
take_ownership | If true , the validator takes ownership of the DTD. The caller must not delete it.If false , the validator does not take ownership of the DTD. The caller must guarantee that the DTD exists as long as the validator keeps a pointer to it. The caller is responsible for deleting the DTD when it's no longer needed. |
|
override |
|
noexcept |
Get the parsed DTD.
nullptr
.
|
noexcept |
Get the parsed DTD.
nullptr
.
|
overrideprotectedvirtual |
Reimplemented from xmlpp::Validator.
|
explicitoverridevirtualnoexcept |
Test whether a DTD has been parsed.
For instance
Implements xmlpp::Validator.
|
overridevirtual |
Parse an external subset (DTD file).
If the validator already contains a DTD, that DTD is deleted.
filename | The URL of the DTD. |
xmlpp::parse_error |
Implements xmlpp::Validator.
|
overridevirtual |
Parse a DTD from a string.
If the validator already contains a DTD, that DTD is deleted.
contents | The DTD as a string. |
xmlpp::parse_error |
Implements xmlpp::Validator.
LIBXMLPP_API void xmlpp::DtdValidator::parse_stream | ( | std::istream & | in | ) |
Parse a DTD from a stream.
If the validator already contains a DTD, that DTD is deleted.
in | The stream. |
xmlpp::parse_error |
LIBXMLPP_API void xmlpp::DtdValidator::parse_subset | ( | const ustring & | external, |
const ustring & | system | ||
) |
Parse an external subset (DTD file).
If the validator already contains a DTD, that DTD is deleted.
external | The external ID of the DTD. |
system | The URL of the DTD. |
xmlpp::parse_error |
|
overrideprotectedvirtual |
Reimplemented from xmlpp::Validator.
LIBXMLPP_API void xmlpp::DtdValidator::set_dtd | ( | Dtd * | dtd, |
bool | take_ownership | ||
) |
Set a DTD.
If the validator already contains a DTD, that DTD is released (deleted if the validator owns the DTD).
dtd | A pointer to the DTD to use when validating XML documents. |
take_ownership | If true , the validator takes ownership of the DTD. The caller must not delete it.If false , the validator does not take ownership of the DTD. The caller must guarantee that the DTD exists as long as the validator keeps a pointer to it. The caller is responsible for deleting the DTD when it's no longer needed. |
|
overridevirtual |
Validate a document, using a previously parsed DTD.
The internal subset (if present) is de-coupled (i.e. not used), which could give problems if ID or IDREF is present.
document | Pointer to the document. |
xmlpp::internal_error | |
xmlpp::validity_error |
Implements xmlpp::Validator.