libxml++  2.36.0
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:
Inheritance graph
[legend]
Collaboration diagram for xmlpp::SchemaValidator:
Collaboration graph
[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.
Schemaget_schema ()
 Get the parsed schema.
const Schemaget_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

Schemaschema_
bool embbeded_shema_
_xmlSchemaValidCtxt* ctxt_
- Protected Attributes inherited from xmlpp::Validator
_xmlValidCtxt* valid_
exceptionexception_
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
fileThe 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
documentA 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
schemaA 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
documentA 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
fileThe 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
contentsThe 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
schemaA 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
docPointer 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
fileThe 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: