libxml++: xmlpp::SchemaValidator Class Reference

libxml++ 2.36.0

- Main Page
- Related Pages
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

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

XML Schema Validator. More...

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

Inheritance diagram for xmlpp::SchemaValidator:
[legend]
Collaboration diagram for xmlpp::SchemaValidator:
[legend]

## Public Member Functions
| SchemaValidator ()
| SchemaValidator (const Glib::ustring& file)
| Create a validator and parse a schema definition file immediately.
| SchemaValidator (Document& document)
| Create a validator and parse a schema definition document immediately.
| SchemaValidator (Schema* schema)
| Create a schema validator.
virtual | ~SchemaValidator ()
virtual void | parse_file (const Glib::ustring& filename)
| Parse a schema definition file.
virtual void | parse_memory (const Glib::ustring& contents)
| Parse a schema definition from a string.
virtual void | parse_document (Document& document)
| Parse a schema definition from a document.
virtual void | set_schema (Schema* schema)
| Set a schema.
| operator bool () const
| Test whether a schema has been parsed.
Schema* | get_schema ()
| Get the parsed schema.
const Schema* | get_schema () const
| Get the parsed schema.
bool | validate (const Document* doc)
| Validate a document, using a previously parsed schema.
bool | validate (const Glib::ustring& file)
| Validate an XML file, using a previously parsed schema.
Public Member Functions inherited from xmlpp::Validator
| Validator ()
virtual | ~Validator ()

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

## Protected Attributes
Schema* | schema_
bool | embbeded_shema_
_xmlSchemaValidCtxt* | ctxt_
Protected Attributes inherited from xmlpp::Validator
_xmlValidCtxt* | valid_
exception* | exception_
Glib::ustring | validate_error_
Glib::ustring | validate_warning_

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

## Detailed Description

XML Schema Validator.

Since libxml++ 2.24:

## Constructor & Destructor Documentation

xmlpp::SchemaValidator::SchemaValidator | ( |  | ) |

xmlpp::SchemaValidator::SchemaValidator | ( | const Glib::ustring & | file | ) |
| explicit

Create a validator and parse a schema definition file immediately.

Parameters

  file | The URL of the schema.

Exceptions

  xmlpp::parse_error |

xmlpp::SchemaValidator::SchemaValidator | ( | Document& | document | ) |
| explicit

Create a validator and parse a schema definition document immediately.

Parameters

  document | A preparsed document tree, containing the schema definition.

Note
  The document may be modified during the parsing process.

Exceptions

  xmlpp::parse_error |

xmlpp::SchemaValidator::SchemaValidator | ( | Schema* | schema | ) |
| explicit

Create a schema validator.

Parameters

  schema | A pointer to the XML schema to use when validating XML documents. 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.

virtual xmlpp::SchemaValidator::~SchemaValidator | ( |  | ) |
| virtual

## Member Function Documentation

Schema* xmlpp::SchemaValidator::get_schema | ( |  | ) |

Get the parsed schema.

Returns
  A pointer to the parsed schema, or `0`.

const Schema* xmlpp::SchemaValidator::get_schema | ( |  | ) | const

Get the parsed schema.

Returns
  A pointer to the parsed schema, or `0`.

virtual void xmlpp::SchemaValidator::initialize_valid | ( |  | ) |
| protectedvirtual

Reimplemented from xmlpp::Validator.

xmlpp::SchemaValidator::operator bool | ( |  | ) | const

Test whether a schema has been parsed.

void xmlpp::SchemaValidator::parse_context | ( | _xmlSchemaParserCtxt * | context | ) |
| protected

virtual void xmlpp::SchemaValidator::parse_document | ( | Document& | document | ) |
| 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

  document | A preparsed document tree, containing the schema definition.

Note
  The document may be modified during the parsing process.

Exceptions

  xmlpp::parse_error |

virtual void xmlpp::SchemaValidator::parse_file | ( | const Glib::ustring & | filename | ) |
| 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

  file | The URL of the schema.

Exceptions

  xmlpp::parse_error |

virtual void xmlpp::SchemaValidator::parse_memory | ( | const Glib::ustring & | contents | ) |
| 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

  contents | The schema definition as a string.

Exceptions

  xmlpp::parse_error |

virtual void xmlpp::SchemaValidator::release_underlying | ( |  | ) |
| protectedvirtual

Reimplemented from xmlpp::Validator.

virtual void xmlpp::SchemaValidator::set_schema | ( | Schema* | schema | ) |
| virtual

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 XML schema to use when validating XML documents. 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.

bool xmlpp::SchemaValidator::validate | ( | const Document* | doc | ) |

Validate a document, using a previously parsed schema.

Parameters

  doc | Pointer to the document.

Returns
  Whether the document is valid.

Exceptions

  xmlpp::internal_error |
  xmlpp::validity_error |

bool xmlpp::SchemaValidator::validate | ( | const Glib::ustring & | file | ) |

Validate an XML file, using a previously parsed schema.

Parameters

  file | The URI of the XML file.

Returns
  Whether the document is valid.

Exceptions

  xmlpp::internal_error |
  xmlpp::validity_error |

## Member Data Documentation

_xmlSchemaValidCtxt* xmlpp::SchemaValidator::ctxt_
| protected

bool xmlpp::SchemaValidator::embbeded_shema_
| protected

Schema* xmlpp::SchemaValidator::schema_
| protected

The documentation for this class was generated from the following file:

- validators/schemavalidator.h