NCBI C++ ToolKit
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
xml::schema Class Reference

Search Toolkit Book for xml::schema

The xml::schema class represents an XML schema. More...

#include <misc/xmlwrapp/schema.hpp>

+ Collaboration diagram for xml::schema:

Public Types

typedef std::size_t size_type
 

Public Member Functions

 schema (const char *filename, error_messages *messages=NULL, warnings_as_errors_type how=type_warnings_not_errors)
 Create a new xml::schema object by parsing the given XML schema file. More...
 
 schema (const char *data, size_type size, error_messages *messages, warnings_as_errors_type how=type_warnings_not_errors)
 Create a new xml::schema object by parsing the given XML schema from a memory buffer. More...
 
bool validate (const document &doc, error_messages *messages, warnings_as_errors_type how=type_warnings_are_errors) const
 Validate the given XML document. More...
 
virtual ~schema ()
 Destroy the object. More...
 

Private Member Functions

void construct (const char *file_or_data, size_type size, error_messages *messages, warnings_as_errors_type how)
 
 schema (const schema &)
 
schemaoperator= (const schema &)
 

Private Attributes

impl::schema_implpimpl_
 

Detailed Description

The xml::schema class represents an XML schema.

Definition at line 60 of file schema.hpp.

Member Typedef Documentation

typedef std::size_t xml::schema::size_type

Definition at line 63 of file schema.hpp.

Constructor & Destructor Documentation

schema::schema ( const char *  filename,
error_messages messages = NULL,
warnings_as_errors_type  how = type_warnings_not_errors 
)

Create a new xml::schema object by parsing the given XML schema file.

Parameters
filenameThe XML schema file name.
messagesA pointer to the object where all the warnings are collected. If NULL then no messages will be collected.
howHow to treat warnings (default: warnings are not treated as errors). If warnings are treated as errors then an exception is thrown in case of both errors and/or warnings. If warnings are not treated as errors then an exception will be thrown only when there are errors.
Exceptions
Throwsxml::parser_exception in case of schema parsing errors and std::exception in case of other problems.
Author
Sergey Satskiy, NCBI

Definition at line 72 of file schema.cpp.

References construct(), and pimpl_.

schema::schema ( const char *  data,
size_type  size,
error_messages messages,
warnings_as_errors_type  how = type_warnings_not_errors 
)

Create a new xml::schema object by parsing the given XML schema from a memory buffer.

Parameters
dataThe XML schema memory buffer.
sizeSize of the memory buffer.
messagesA pointer to the object where all the warnings are collected. If NULL then no messages will be collected.
howHow to treat warnings (default: warnings are not treated as errors). If warnings are treated as errors then an exception is thrown in case of both errors and/or warnings. If warnings are not treated as errors then an exception will be thrown only when there are errors.
Exceptions
Throwsxml::parser_exception in case of schema parsing errors and std::exception in case of other problems.
Author
Sergey Satskiy, NCBI

Definition at line 88 of file schema.cpp.

References construct(), and pimpl_.

schema::~schema ( )
virtual

Destroy the object.

Author
Sergey Satskiy, NCBI

Definition at line 185 of file schema.cpp.

References pimpl_, and xml::impl::schema_impl::schema_.

xml::schema::schema ( const schema )
private

Member Function Documentation

void schema::construct ( const char *  file_or_data,
size_type  size,
error_messages messages,
warnings_as_errors_type  how 
)
private
schema& xml::schema::operator= ( const schema )
private
bool schema::validate ( const document doc,
error_messages messages,
warnings_as_errors_type  how = type_warnings_are_errors 
) const

Validate the given XML document.

Parameters
docXML document.
messagesA pointer to the object where all the warnings are collected. If NULL then no messages will be collected.
howHow to treat warnings (default: warnings are treated as errors). If warnings are treated as errors false is returned in case of both errors and/or warnings. If warnings are not treated as errors then false is returned only when there are errors.
Returns
true if the document is valid, false otherwise.
Exceptions
Throwsstd::exception in case of problems.
Author
Sergey Satskiy, NCBI

Definition at line 104 of file schema.cpp.

References xml::impl::doc_impl::doc_, xml::error_messages::get_messages(), xml::error_messages::has_errors(), xml::error_messages::has_warnings(), pimpl_, xml::document::pimpl_, xml::impl::schema_impl::schema_, and xml::type_warnings_are_errors.

Referenced by xml::document::validate().

Member Data Documentation

impl::schema_impl* xml::schema::pimpl_
private

Definition at line 130 of file schema.hpp.

Referenced by construct(), schema(), validate(), and ~schema().


The documentation for this class was generated from the following files:
Modified on Tue Feb 09 17:03:05 2016 by modify_doxy.py rev. 426318