|
||||
File indexing completed on 2025-01-30 10:27:31
0001 /* 0002 * Licensed to the Apache Software Foundation (ASF) under one or more 0003 * contributor license agreements. See the NOTICE file distributed with 0004 * this work for additional information regarding copyright ownership. 0005 * The ASF licenses this file to You under the Apache License, Version 2.0 0006 * (the "License"); you may not use this file except in compliance with 0007 * the License. You may obtain a copy of the License at 0008 * 0009 * http://www.apache.org/licenses/LICENSE-2.0 0010 * 0011 * Unless required by applicable law or agreed to in writing, software 0012 * distributed under the License is distributed on an "AS IS" BASIS, 0013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0014 * See the License for the specific language governing permissions and 0015 * limitations under the License. 0016 */ 0017 0018 /* 0019 * $Id$ 0020 */ 0021 0022 #if !defined(XERCESC_INCLUDE_GUARD_DTDVALIDATOR_HPP) 0023 #define XERCESC_INCLUDE_GUARD_DTDVALIDATOR_HPP 0024 0025 #include <xercesc/util/NameIdPool.hpp> 0026 #include <xercesc/framework/XMLValidator.hpp> 0027 #include <xercesc/validators/DTD/DTDGrammar.hpp> 0028 0029 XERCES_CPP_NAMESPACE_BEGIN 0030 0031 class XMLMsgLoader; 0032 0033 0034 // 0035 // This is a derivative of the abstract validator interface. This class 0036 // implements a validator that supports standard XML 1.0 DTD semantics. 0037 // This class handles scanning the internal and external subsets of the 0038 // DTD, and provides the standard validation services against the DTD info 0039 // it found. 0040 // 0041 class VALIDATORS_EXPORT DTDValidator : public XMLValidator 0042 { 0043 public: 0044 // ----------------------------------------------------------------------- 0045 // Constructors and Destructor 0046 // ----------------------------------------------------------------------- 0047 DTDValidator(XMLErrorReporter* const errReporter = 0); 0048 virtual ~DTDValidator(); 0049 0050 // ----------------------------------------------------------------------- 0051 // Implementation of the XMLValidator interface 0052 // ----------------------------------------------------------------------- 0053 virtual bool checkContent 0054 ( 0055 XMLElementDecl* const elemDecl 0056 , QName** const children 0057 , XMLSize_t childCount 0058 , XMLSize_t* indexFailingChild 0059 ); 0060 0061 virtual void faultInAttr 0062 ( 0063 XMLAttr& toFill 0064 , const XMLAttDef& attDef 0065 ) const; 0066 0067 virtual void preContentValidation(bool reuseGrammar, 0068 bool validateDefAttr = false); 0069 0070 virtual void postParseValidation(); 0071 0072 virtual void reset(); 0073 0074 virtual bool requiresNamespaces() const; 0075 0076 virtual void validateAttrValue 0077 ( 0078 const XMLAttDef* attDef 0079 , const XMLCh* const attrValue 0080 , bool preValidation = false 0081 , const XMLElementDecl* elemDecl = 0 0082 ); 0083 virtual void validateElement 0084 ( 0085 const XMLElementDecl* elemDef 0086 ); 0087 virtual Grammar* getGrammar() const; 0088 virtual void setGrammar(Grammar* aGrammar); 0089 0090 // ----------------------------------------------------------------------- 0091 // Virtual DTD handler interface. 0092 // ----------------------------------------------------------------------- 0093 virtual bool handlesDTD() const; 0094 0095 // ----------------------------------------------------------------------- 0096 // Virtual Schema handler interface. handlesSchema() always return false. 0097 // ----------------------------------------------------------------------- 0098 virtual bool handlesSchema() const; 0099 0100 private: 0101 // ----------------------------------------------------------------------- 0102 // Unimplemented constructors and operators 0103 // ----------------------------------------------------------------------- 0104 DTDValidator(const DTDValidator &); 0105 DTDValidator& operator = (const DTDValidator&); 0106 0107 // ----------------------------------------------------------------------- 0108 // Helper 0109 // ----------------------------------------------------------------------- 0110 void checkTokenList(const XMLAttDef& attDef 0111 , bool toValidateNotation); 0112 0113 // ----------------------------------------------------------------------- 0114 // Private data members 0115 // 0116 // fDTDGrammar 0117 // The DTD information stored. 0118 // 0119 // ----------------------------------------------------------------------- 0120 DTDGrammar* fDTDGrammar; 0121 }; 0122 0123 // --------------------------------------------------------------------------- 0124 // Virtual interface 0125 // --------------------------------------------------------------------------- 0126 inline Grammar* DTDValidator::getGrammar() const { 0127 return fDTDGrammar; 0128 } 0129 0130 inline void DTDValidator::setGrammar(Grammar* aGrammar) { 0131 fDTDGrammar = (DTDGrammar*) aGrammar; 0132 } 0133 0134 inline void DTDValidator::validateElement (const XMLElementDecl*) { 0135 // no special DTD Element validation 0136 } 0137 0138 // --------------------------------------------------------------------------- 0139 // DTDValidator: DTD handler interface 0140 // --------------------------------------------------------------------------- 0141 inline bool DTDValidator::handlesDTD() const 0142 { 0143 // We definitely want to handle DTD scanning 0144 return true; 0145 } 0146 0147 // --------------------------------------------------------------------------- 0148 // DTDValidator: Schema handler interface 0149 // --------------------------------------------------------------------------- 0150 inline bool DTDValidator::handlesSchema() const 0151 { 0152 // No Schema scanning 0153 return false; 0154 } 0155 0156 XERCES_CPP_NAMESPACE_END 0157 0158 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |