2 * Copyright 2001-2006 Internet2
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
18 * @file ValidatingXMLObject.h
\r
20 * An XMLObject that can evaluate per-object validation rules.
\r
23 #if !defined(__xmltooling_valxmlobj_h__)
\r
24 #define __xmltooling_valxmlobj_h__
\r
27 #include <xmltooling/XMLObject.h>
\r
28 #include <xmltooling/validation/Validator.h>
\r
30 #if defined (_MSC_VER)
\r
31 #pragma warning( push )
\r
32 #pragma warning( disable : 4250 4251 )
\r
35 namespace xmltooling {
\r
38 * A functional interface for XMLObjects that offer the ability
\r
39 * to evaluate validation rules defined per-object.
\r
41 class XMLTOOL_API ValidatingXMLObject : public virtual XMLObject
\r
44 ValidatingXMLObject() {}
\r
47 virtual ~ValidatingXMLObject() {}
\r
50 * Registers a validator for this XMLObject.
\r
52 * @param validator the validator
\r
54 virtual void registerValidator(Validator* validator)=0;
\r
57 * Deregisters a validator for this XMLObject.
\r
59 * @param validator the validator
\r
61 virtual void deregisterValidator(Validator* validator)=0;
\r
64 * Deregisters all validators for this XMLObject.
\r
66 virtual void deregisterAll()=0;
\r
69 * Validates this XMLObject against all registered validators.
\r
71 * @param validateDescendants true if all the descendants of this object should
\r
72 * be validated as well, false if not
\r
74 * @throws ValidationException thrown if the object is not valid
\r
76 virtual void validate(bool validateDescendants) const=0;
\r
81 #if defined (_MSC_VER)
\r
82 #pragma warning( pop )
\r
85 #endif /* __xmltooling_valxmlobj_h__ */
\r