RelaxNG schema validator.
More...
#include <libxml++/validators/relaxngvalidator.h>
RelaxNG schema validator.
RelaxNG = REgular LAnguage for XML Next Generation
- Since libxml++ 2.38:
◆ RelaxNGValidator() [1/4]
| LIBXMLPP_API xmlpp::RelaxNGValidator::RelaxNGValidator |
( |
| ) |
|
◆ RelaxNGValidator() [2/4]
| LIBXMLPP_API xmlpp::RelaxNGValidator::RelaxNGValidator |
( |
const Glib::ustring & |
filename | ) |
|
|
explicit |
Create a validator and parse a schema definition file.
The schema must be defined with XML syntax (.rng file). The compact syntax (.rnc file) is not supported.
- Parameters
-
| filename | The URL of the schema. |
- Exceptions
-
◆ RelaxNGValidator() [3/4]
| LIBXMLPP_API xmlpp::RelaxNGValidator::RelaxNGValidator |
( |
const Document * |
document | ) |
|
|
explicit |
Create a validator and parse a schema definition document.
- Parameters
-
| document | A preparsed document tree, containing the schema definition. |
- Exceptions
-
◆ RelaxNGValidator() [4/4]
| LIBXMLPP_API xmlpp::RelaxNGValidator::RelaxNGValidator |
( |
RelaxNGSchema * |
schema, |
|
|
bool |
take_ownership |
|
) |
| |
|
explicit |
Create a validator.
- Parameters
-
| schema | A pointer to the schema to use when validating XML documents. |
| take_ownership | If true, the validator takes ownership of the schema. The caller must not delete it.
If false, the validator does not take ownership of the schema. The caller must guarantee that the schema exists as long as the validator keeps a pointer to it. The caller is responsible for deleting the schema when it's no longer needed. |
◆ ~RelaxNGValidator()
| LIBXMLPP_API xmlpp::RelaxNGValidator::~RelaxNGValidator |
( |
| ) |
|
|
override |
◆ get_schema() [1/2]
| LIBXMLPP_API RelaxNGSchema* xmlpp::RelaxNGValidator::get_schema |
( |
| ) |
|
Get the schema.
- Returns
- A pointer to the schema, or
nullptr.
◆ get_schema() [2/2]
| LIBXMLPP_API const RelaxNGSchema* xmlpp::RelaxNGValidator::get_schema |
( |
| ) |
const |
Get the schema.
- Returns
- A pointer to the schema, or
nullptr.
◆ initialize_valid()
| LIBXMLPP_API void xmlpp::RelaxNGValidator::initialize_valid |
( |
| ) |
|
|
overrideprotectedvirtual |
◆ operator BoolExpr()
| LIBXMLPP_API xmlpp::RelaxNGValidator::operator BoolExpr |
( |
| ) |
const |
|
overridevirtual |
◆ parse_document()
| LIBXMLPP_API void xmlpp::RelaxNGValidator::parse_document |
( |
const Document * |
document | ) |
|
|
overridevirtual |
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
-
| document | A preparsed document tree, containing the schema definition. |
- Exceptions
-
Implements xmlpp::SchemaValidatorBase.
◆ parse_file()
| LIBXMLPP_API void xmlpp::RelaxNGValidator::parse_file |
( |
const Glib::ustring & |
filename | ) |
|
|
overridevirtual |
Parse a schema definition file.
The schema must be defined with XML syntax (.rng file). The compact syntax (.rnc file) is not supported.
If the validator already contains a schema, that schema is released (deleted if the validator owns the schema).
- Parameters
-
| filename | The URL of the schema. |
- Exceptions
-
Implements xmlpp::SchemaValidatorBase.
◆ parse_memory()
| LIBXMLPP_API void xmlpp::RelaxNGValidator::parse_memory |
( |
const Glib::ustring & |
contents | ) |
|
|
overridevirtual |
Parse a schema definition from a string.
The schema must be defined with XML syntax. The compact syntax is not supported.
If the validator already contains a schema, that schema is released (deleted if the validator owns the schema).
- Parameters
-
| contents | The schema definition as a string. |
- Exceptions
-
Implements xmlpp::SchemaValidatorBase.
◆ release_underlying()
| LIBXMLPP_API void xmlpp::RelaxNGValidator::release_underlying |
( |
| ) |
|
|
overrideprotectedvirtual |
◆ set_schema()
| LIBXMLPP_API void xmlpp::RelaxNGValidator::set_schema |
( |
RelaxNGSchema * |
schema, |
|
|
bool |
take_ownership |
|
) |
| |
Set a schema.
If the validator already contains a schema, that schema is released (deleted if the validator owns the schema).
- Parameters
-
| schema | A pointer to the schema to use when validating XML documents. |
| take_ownership | If true, the validator takes ownership of the schema. The caller must not delete it.
If false, the validator does not take ownership of the schema. The caller must guarantee that the schema exists as long as the validator keeps a pointer to it. The caller is responsible for deleting the schema when it's no longer needed. |
◆ validate() [1/2]
| LIBXMLPP_API void xmlpp::RelaxNGValidator::validate |
( |
const Document * |
document | ) |
|
|
overridevirtual |
Validate a document, using a previously parsed schema.
- Parameters
-
| document | Pointer to the document. |
- Exceptions
-
Implements xmlpp::SchemaValidatorBase.
◆ validate() [2/2]
| LIBXMLPP_API void xmlpp::RelaxNGValidator::validate |
( |
const Glib::ustring & |
filename | ) |
|
|
overridevirtual |
Validate an XML file, using a previously parsed schema.
- Parameters
-
| filename | The URL of the XML file. |
- Exceptions
-
Implements xmlpp::SchemaValidatorBase.