xmlpp::SchemaValidator Class Reference

XML Schema Validator. More...

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

Inheritance diagram for xmlpp::SchemaValidator:
[legend]

## Public Member Functions

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

## Protected Member Functions

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

## Protected Attributes

_xmlSchemaValidCtxt* | ctxt_
bool | embbeded_shema_
Schema* | schema_
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 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:

Deprecated:
  Use XsdValidator instead.

## 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 |

Deprecated:
  Use XsdValidator instead.

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 |

Deprecated:
  Use XsdValidator instead.

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.

Deprecated:
  Use XsdValidator instead.

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

override

## Member Function Documentation

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

Get the parsed schema.

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

Deprecated:
  Use XsdValidator::get_schema() instead.

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

Get the parsed schema.

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

Deprecated:
  Use XsdValidator::get_schema() instead.

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

override protected virtual

Reimplemented from xmlpp::Validator.

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

Test whether a schema has been parsed.

Deprecated:
  Use XsdValidator::operator BoolExpr() instead.

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 |

Deprecated:
  Use XsdValidator::parse_document() instead.

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

  filename | The URL of the schema.

Exceptions

  xmlpp::parse_error |

Deprecated:
  Use XsdValidator::parse_file() instead.

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 |

Deprecated:
  Use XsdValidator::parse_memory() instead.

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

override protected virtual

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.

Deprecated:
  Use XsdValidator::set_schema() instead.

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 |

Deprecated:
  Use XsdValidator::validate(const Document*) instead.

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 |

Deprecated:
  Use XsdValidator::validate(const Glib::ustring&) instead.

## Member Data Documentation

_xmlSchemaValidCtxt* xmlpp::SchemaValidator::ctxt_

protected

bool xmlpp::SchemaValidator::embbeded_shema_

protected

Schema* xmlpp::SchemaValidator::schema_

protected