⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 schemavalidator.hpp

📁 经典开源游戏glest的源代码
💻 HPP
📖 第 1 页 / 共 2 页
字号:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements.  See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License.  You may obtain a copy of the License at *  *      http://www.apache.org/licenses/LICENSE-2.0 *  * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *//* * $Id: SchemaValidator.hpp 568078 2007-08-21 11:43:25Z amassari $ */#if !defined(SCHEMAVALIDATOR_HPP)#define SCHEMAVALIDATOR_HPP#include <xercesc/framework/XMLValidator.hpp>#include <xercesc/framework/XMLBuffer.hpp>#include <xercesc/util/ValueStackOf.hpp>#include <xercesc/validators/common/ContentSpecNode.hpp>#include <xercesc/validators/schema/SchemaGrammar.hpp>#include <xercesc/validators/schema/XSDErrorReporter.hpp>XERCES_CPP_NAMESPACE_BEGINclass GrammarResolver;class DatatypeValidator;class SchemaElementDecl;////  This is a derivative of the abstract validator interface. This class//  implements a validator that supports standard XML Schema semantics.//  This class handles scanning the of the schema, and provides//  the standard validation services against the Schema info it found.//class VALIDATORS_EXPORT SchemaValidator : public XMLValidator{public:    // -----------------------------------------------------------------------    //  Constructors and Destructor    // -----------------------------------------------------------------------    SchemaValidator    (          XMLErrorReporter* const errReporter = 0          , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager    );    virtual ~SchemaValidator();    // -----------------------------------------------------------------------    //  Implementation of the XMLValidator interface    // -----------------------------------------------------------------------    virtual int checkContent    (        XMLElementDecl* const   elemDecl        , QName** const         children        , const unsigned int    childCount    );    virtual void faultInAttr    (                XMLAttr&    toFill        , const XMLAttDef&  attDef    )   const;    virtual void preContentValidation(bool reuseGrammar,                                      bool validateDefAttr = false);    virtual void postParseValidation();    virtual void reset();    virtual bool requiresNamespaces() const;    virtual void validateAttrValue    (        const   XMLAttDef*                  attDef        , const XMLCh* const                attrValue        , bool                              preValidation = false        , const XMLElementDecl*             elemDecl = 0    );    virtual void validateElement    (        const   XMLElementDecl*             elemDef    );    virtual Grammar* getGrammar() const;    virtual void setGrammar(Grammar* aGrammar);    // -----------------------------------------------------------------------    //  Virtual DTD handler interface.    // -----------------------------------------------------------------------    virtual bool handlesDTD() const;    // -----------------------------------------------------------------------    //  Virtual Schema handler interface. handlesSchema() always return false.    // -----------------------------------------------------------------------    virtual bool handlesSchema() const;    // -----------------------------------------------------------------------    //  Schema Validator methods    // -----------------------------------------------------------------------    void normalizeWhiteSpace(DatatypeValidator* dV, const XMLCh* const value, XMLBuffer& toFill);    // -----------------------------------------------------------------------    //  Setter methods    // -----------------------------------------------------------------------    void setGrammarResolver(GrammarResolver* grammarResolver);    void setXsiType(const XMLCh* const        prefix      , const XMLCh* const        localPart       , const unsigned int        uriId);    void setNillable(bool isNil);    void setErrorReporter(XMLErrorReporter* const errorReporter);    void setExitOnFirstFatal(const bool newValue);    void setDatatypeBuffer(const XMLCh* const value);    void clearDatatypeBuffer();    // -----------------------------------------------------------------------    //  Getter methods    // -----------------------------------------------------------------------    ComplexTypeInfo* getCurrentTypeInfo() const;    DatatypeValidator *getCurrentDatatypeValidator() const;    DatatypeValidator *getMostRecentAttrValidator() const;    bool getErrorOccurred() const;    bool getIsElemSpecified() const;    const XMLCh* getNormalizedValue() const;private:    // -----------------------------------------------------------------------    //  Unimplemented constructors and operators    // -----------------------------------------------------------------------    SchemaValidator(const SchemaValidator&);    SchemaValidator& operator=(const SchemaValidator&);    // -----------------------------------------------------------------------    //  Element Consitency Checking methods    // -----------------------------------------------------------------------    void checkRefElementConsistency(SchemaGrammar* const currentGrammar,                                    const ComplexTypeInfo* const curTypeInfo,                                    const XercesGroupInfo* const curGroup = 0);    // -----------------------------------------------------------------------    //  Particle Derivation Checking methods    // -----------------------------------------------------------------------    void checkParticleDerivation(SchemaGrammar* const currentGrammar,                                 const ComplexTypeInfo* const typeInfo);    void checkParticleDerivationOk(SchemaGrammar* const currentGrammar,                                   ContentSpecNode* const curNode,                                   const int derivedScope,                                   ContentSpecNode* const baseNode,                                   const int baseScope,                                   const ComplexTypeInfo* const baseInfo = 0,                                   const bool toCheckOccurrence = true);    ContentSpecNode* checkForPointlessOccurrences(ContentSpecNode* const specNode,                                                  const ContentSpecNode::NodeTypes nodeType,                                                  ValueVectorOf<ContentSpecNode*>* const nodes);    void gatherChildren(const ContentSpecNode::NodeTypes parentNodeType,                        ContentSpecNode* const specNode,                        ValueVectorOf<ContentSpecNode*>* const nodes);    bool isOccurrenceRangeOK(const int min1, const int max1, const int min2, const int max2);    void checkNSCompat(const ContentSpecNode* const derivedSpecNode,                       const ContentSpecNode* const baseSpecNode,                       const bool toCheckOccurence);    bool wildcardEltAllowsNamespace(const ContentSpecNode* const baseSpecNode,                                    const unsigned int derivedURI);    void checkNameAndTypeOK(SchemaGrammar* const currentGrammar,                            const ContentSpecNode* const derivedSpecNode,                            const int derivedScope,                            const ContentSpecNode* const baseSpecNode,                            const int baseScope,                            const ComplexTypeInfo* const baseInfo = 0);    SchemaElementDecl* findElement(const int scope,                                   const unsigned int uriIndex,                                   const XMLCh* const name,                                   SchemaGrammar* const grammar,                                   const ComplexTypeInfo* const typeInfo = 0);    void checkICRestriction(const SchemaElementDecl* const derivedElemDecl,                            const SchemaElementDecl* const baseElemDecl,                            const XMLCh* const derivedElemName,                            const XMLCh* const baseElemName);    void checkTypesOK(const SchemaElementDecl* const derivedElemDecl,                      const SchemaElementDecl* const baseElemDecl,                      const XMLCh* const derivedElemName);    void checkRecurseAsIfGroup(SchemaGrammar* const currentGrammar,                               ContentSpecNode* const derivedSpecNode,                               const int derivedScope,                               const ContentSpecNode* const baseSpecNode,                               const int baseScope,                               ValueVectorOf<ContentSpecNode*>* const nodes,                               const ComplexTypeInfo* const baseInfo);    void checkRecurse(SchemaGrammar* const currentGrammar,                      const ContentSpecNode* const derivedSpecNode,                      const int derivedScope,                      ValueVectorOf<ContentSpecNode*>* const derivedNodes,                      const ContentSpecNode* const baseSpecNode,                      const int baseScope,                      ValueVectorOf<ContentSpecNode*>* const baseNodes,                      const ComplexTypeInfo* const baseInfo,                      const bool toLax = false);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -