xmlwrapp
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
xmlwrapp
schema.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2013 Vaclav Slavik <vslavik@gmail.com>
3
* All Rights Reserved
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
7
* are met:
8
*
9
* 1. Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
* 2. Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in
13
* the documentation and/or other materials provided with the
14
* distribution.
15
* 3. Neither the name of the Author nor the names of its contributors
16
* may be used to endorse or promote products derived from this software
17
* without specific prior written permission.
18
*
19
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
20
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
23
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
29
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30
* SUCH DAMAGE.
31
*/
32
33
/**
34
@file
35
36
This file contains the definition of the xml::schema class.
37
*/
38
39
#ifndef _xmlwrapp_schema_h_
40
#define _xmlwrapp_schema_h_
41
42
// xmlwrapp includes
43
#include "
xmlwrapp/init.h
"
44
#include "xmlwrapp/export.h"
45
#include "
xmlwrapp/errors.h
"
46
47
namespace
xml
48
{
49
50
// forward declarations
51
class
document;
52
class
error_messages;
53
54
namespace
impl
55
{
56
struct
schema_impl;
57
}
58
59
/**
60
XML Schema.
61
62
This class is used to validate documents against XML Schema.
63
64
@since 0.7.0
65
*/
66
class
XMLWRAPP_API
schema
67
{
68
public
:
69
/**
70
Parses XML Schema document and creates schema instance from it.
71
72
Errors are handled by @a on_error handler; by default, xml::exception
73
is thrown on errors. If there's a fatal error that prevents the schema
74
from being loaded and the error handler doesn't throw an exception, the
75
constructor will throw xml::exception anyway.
76
*/
77
explicit
schema
(
const
document
& doc,
error_handler
& on_error =
throw_on_error
);
78
79
/// Destructor
80
~
schema
();
81
82
/**
83
Validates the document @a doc against the schema.
84
85
Errors are handled by @a on_error handler; by default, xml::exception
86
is thrown on errors.
87
88
@return `true` if the document is valid with regard to the schema,
89
`false` otherwise.
90
*/
91
bool
validate(
const
document
& doc,
error_handler
& on_error =
throw_on_error
)
const
;
92
93
private
:
94
impl::schema_impl *pimpl_;
95
96
// Schema class is not copyable
97
schema
(
const
schema
&);
98
schema
& operator=(
const
schema
&);
99
};
100
101
}
// namespace xml
102
103
#endif // _xmlwrapp_schema_h_
Generated on Sat Mar 16 2013 12:46:44 for xmlwrapp by
1.8.3.1