libxml++  2.42.1
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]

Public Member Functions

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

Protected Member Functions

LIBXMLPP_API void initialize_valid () override
 
LIBXMLPP_API void parse_context (_xmlSchemaParserCtxt* context)
 
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 on_validity_error (const Glib::ustring& message)
 
virtual LIBXMLPP_API void on_validity_warning (const Glib::ustring& message)
 

Protected Attributes

_xmlSchemaValidCtxt* ctxt_
 
bool embbeded_shema_
 
Schemaschema_
 
- Protected Attributes inherited from xmlpp::Validator
exceptionexception_
 
_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 Schema Validator.

Since libxml++ 2.24:
Deprecated:
Use XsdValidator instead.

Constructor & Destructor Documentation

◆ SchemaValidator() [1/4]

LIBXMLPP_API xmlpp::SchemaValidator::SchemaValidator ( )

◆ SchemaValidator() [2/4]

LIBXMLPP_API 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
Deprecated:
Use XsdValidator instead.

◆ SchemaValidator() [3/4]

LIBXMLPP_API 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
Deprecated:
Use XsdValidator instead.

◆ SchemaValidator() [4/4]

LIBXMLPP_API 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.
Deprecated:
Use XsdValidator instead.

◆ ~SchemaValidator()

LIBXMLPP_API xmlpp::SchemaValidator::~SchemaValidator ( )
override

Member Function Documentation

◆ get_schema() [1/2]

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

Get the parsed schema.

Returns
A pointer to the parsed schema, or 0.
Deprecated:
Use XsdValidator::get_schema() instead.

◆ get_schema() [2/2]

LIBXMLPP_API 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.

◆ initialize_valid()

LIBXMLPP_API void xmlpp::SchemaValidator::initialize_valid ( )
overrideprotectedvirtual

Reimplemented from xmlpp::Validator.

◆ operator bool()

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

Test whether a schema has been parsed.

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

◆ parse_context()

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

◆ parse_document()

virtual LIBXMLPP_API 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
Deprecated:
Use XsdValidator::parse_document() instead.

◆ parse_file()

virtual LIBXMLPP_API 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
filenameThe URL of the schema.
Exceptions
xmlpp::parse_error
Deprecated:
Use XsdValidator::parse_file() instead.

◆ parse_memory()

virtual LIBXMLPP_API 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
Deprecated:
Use XsdValidator::parse_memory() instead.

◆ release_underlying()

LIBXMLPP_API void xmlpp::SchemaValidator::release_underlying ( )
overrideprotectedvirtual

Reimplemented from xmlpp::Validator.

◆ set_schema()

virtual LIBXMLPP_API 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.
Deprecated:
Use XsdValidator::set_schema() instead.

◆ validate() [1/2]

LIBXMLPP_API 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
Deprecated:
Use XsdValidator::validate(const Document*) instead.

◆ validate() [2/2]

LIBXMLPP_API 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
Deprecated:
Use XsdValidator::validate(const Glib::ustring&) instead.

Member Data Documentation

◆ ctxt_

_xmlSchemaValidCtxt* xmlpp::SchemaValidator::ctxt_
protected

◆ embbeded_shema_

bool xmlpp::SchemaValidator::embbeded_shema_
protected

◆ schema_

Schema* xmlpp::SchemaValidator::schema_
protected