libxml++: xmlpp::DtdValidator Class Reference

libxml++ 2.42.1

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
xmlpp::DtdValidator Class Reference

XML DTD validator. More...

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

Inheritance diagram for xmlpp::DtdValidator:
[legend]

## Public Member Functions
LIBXMLPP_API | DtdValidator ()
LIBXMLPP_API | DtdValidator (const Glib::ustring & external, const Glib::ustring & system)
| Create a validator and parse an external subset (DTD file) immediately. More...
LIBXMLPP_API | DtdValidator (const Glib::ustring & file)
| Create a validator and parse an external subset (DTD file) immediately. More...
LIBXMLPP_API | ~DtdValidator () override
LIBXMLPP_API Dtd * | get_dtd ()
| Get the parsed DTD. More...
LIBXMLPP_API const Dtd * | get_dtd () const
| Get the parsed DTD. More...
LIBXMLPP_API | operator bool () const
| Test whether a DTD has been parsed. More...
virtual LIBXMLPP_API void | parse_file (const Glib::ustring & filename)
| Parse an external subset (DTD file). More...
virtual LIBXMLPP_API void | parse_memory (const Glib::ustring & contents)
| Parse a DTD from a string. More...
virtual LIBXMLPP_API void | parse_stream (std::istream & in)
| Parse a DTD from a stream. More...
virtual LIBXMLPP_API void | parse_subset (const Glib::ustring & external, const Glib::ustring & system)
| Parse an external subset (DTD file). More...
LIBXMLPP_API bool | validate (const Document * doc)
| Validate a document, using a previously parsed DTD. More...
Public Member Functions inherited from xmlpp::Validator
LIBXMLPP_API | Validator ()
LIBXMLPP_API | ~Validator () override

## Protected Member Functions
LIBXMLPP_API void | release_underlying () override
Protected Member Functions inherited from xmlpp::Validator
virtual LIBXMLPP_API void | check_for_exception ()
virtual LIBXMLPP_API void | check_for_validity_messages ()
virtual LIBXMLPP_API void | handleException (const exception & e)
virtual LIBXMLPP_API void | initialize_valid ()
virtual LIBXMLPP_API void | on_validity_error (const Glib::ustring & message)
virtual LIBXMLPP_API void | on_validity_warning (const Glib::ustring & message)

## Protected Attributes
Dtd * | dtd_
Protected Attributes inherited from xmlpp::Validator
exception * | exception_
_xmlValidCtxt * | valid_
Glib::ustring | validate_error_
Glib::ustring | validate_warning_

## Additional Inherited Members
Static Protected Member Functions inherited from xmlpp::Validator
static LIBXMLPP_API void | callback_validity_error (void * ctx, const char * msg,...)
static LIBXMLPP_API void | callback_validity_warning (void * ctx, const char * msg,...)

## Detailed Description

XML DTD validator.

## Constructor & Destructor Documentation

## ◆ DtdValidator() [1/3]

LIBXMLPP_API xmlpp::DtdValidator::DtdValidator | ( |  | ) |

## ◆ DtdValidator() [2/3]

LIBXMLPP_API xmlpp::DtdValidator::DtdValidator | ( | const Glib::ustring & | file | ) |
| explicit

Create a validator and parse an external subset (DTD file) immediately.

Parameters

  file | The URL of the DTD.

Exceptions

  xmlpp::parse_error |

## ◆ DtdValidator() [3/3]

LIBXMLPP_API xmlpp::DtdValidator::DtdValidator | ( | const Glib::ustring & | external,
|  | const Glib::ustring & | system
| ) |  |
| explicit

Create a validator and parse an external subset (DTD file) immediately.

Parameters

  external | The external ID of the DTD.
  system | The URL of the DTD.

Exceptions

  xmlpp::parse_error |

## ◆ ~DtdValidator()

LIBXMLPP_API xmlpp::DtdValidator::~DtdValidator | ( |  | ) |
| override

## Member Function Documentation

## ◆ get_dtd() [1/2]

LIBXMLPP_API Dtd * xmlpp::DtdValidator::get_dtd | ( |  | ) |

Get the parsed DTD.

Returns
  A pointer to the parsed DTD, or `nullptr`.

## ◆ get_dtd() [2/2]

LIBXMLPP_API const Dtd * xmlpp::DtdValidator::get_dtd | ( |  | ) | const

Get the parsed DTD.

Returns
  A pointer to the parsed DTD, or `nullptr`.

## ◆ operator bool()

LIBXMLPP_API xmlpp::DtdValidator::operator bool | ( |  | ) | const

Test whether a DTD has been parsed.

## ◆ parse_file()

virtual LIBXMLPP_API void xmlpp::DtdValidator::parse_file | ( | const Glib::ustring & | filename | ) |
| virtual

Parse an external subset (DTD file).

If the validator already contains a DTD, that DTD is deleted.

Parameters

  filename | The URL of the DTD.

Exceptions

  xmlpp::parse_error |

## ◆ parse_memory()

virtual LIBXMLPP_API void xmlpp::DtdValidator::parse_memory | ( | const Glib::ustring & | contents | ) |
| virtual

Parse a DTD from a string.

If the validator already contains a DTD, that DTD is deleted.

Parameters

  contents | The DTD as a string.

Exceptions

  xmlpp::parse_error |

## ◆ parse_stream()

virtual LIBXMLPP_API void xmlpp::DtdValidator::parse_stream | ( | std::istream & | in | ) |
| virtual

Parse a DTD from a stream.

If the validator already contains a DTD, that DTD is deleted.

Parameters

  in | The stream.

Exceptions

  xmlpp::parse_error |

## ◆ parse_subset()

virtual LIBXMLPP_API void xmlpp::DtdValidator::parse_subset | ( | const Glib::ustring & | external,
|  | const Glib::ustring & | system
| ) |  |
| virtual

Parse an external subset (DTD file).

If the validator already contains a DTD, that DTD is deleted.

Parameters

  external | The external ID of the DTD.
  system | The URL of the DTD.

Exceptions

  xmlpp::parse_error |

## ◆ release_underlying()

LIBXMLPP_API void xmlpp::DtdValidator::release_underlying | ( |  | ) |
| overrideprotectedvirtual

Reimplemented from xmlpp::Validator.

## ◆ validate()

LIBXMLPP_API bool xmlpp::DtdValidator::validate | ( | const Document * | doc | ) |

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.

Parameters

  doc | Pointer to the document.

Returns
  Whether the document is valid.

Exceptions

  xmlpp::internal_error |
  xmlpp::validity_error |

## Member Data Documentation

## ◆ dtd_

Dtd* xmlpp::DtdValidator::dtd_
| protected