SourceForge.net Logo

DocumentCache.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001, 2008,
00003  *     DecisionSoft Limited. All rights reserved.
00004  * Copyright (c) 2004, 2011,
00005  *     Oracle and/or its affiliates. All rights reserved.
00006  *
00007  * Licensed under the Apache License, Version 2.0 (the "License");
00008  * you may not use this file except in compliance with the License.
00009  * You may obtain a copy of the License at
00010  *
00011  *     http://www.apache.org/licenses/LICENSE-2.0
00012  *
00013  * Unless required by applicable law or agreed to in writing, software
00014  * distributed under the License is distributed on an "AS IS" BASIS,
00015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016  * See the License for the specific language governing permissions and
00017  * limitations under the License.
00018  */
00019 
00020 #ifndef _DOCUMENTCACHE_HPP
00021 #define _DOCUMENTCACHE_HPP
00022 
00023 #include <vector>
00024 
00025 #include <xqilla/framework/XPath2MemoryManager.hpp>
00026 #include <xqilla/items/Node.hpp>
00027 
00028 #include <xercesc/util/XercesDefs.hpp>
00029 #include <xercesc/util/XMemory.hpp>
00030 
00031 class DynamicContext;
00032 class StaticContext;
00033 class QualifiedName;
00034 class LocationInfo;
00035 class QueryPathNode;
00036 
00037 typedef std::vector<const XMLCh*, XQillaAllocator<const XMLCh*> > VectorOfStrings;
00038 
00039 XERCES_CPP_NAMESPACE_BEGIN
00040 class DOMDocument;
00041 class DOMNode;
00042 class DatatypeValidator;
00043 class XMLEntityResolver;
00044 class ComplexTypeInfo;
00045 class SchemaElementDecl;
00046 class SchemaAttDef;
00047 class InputSource;
00048 class GrammarResolver;
00049 XERCES_CPP_NAMESPACE_END
00050 
00052 class XQILLA_API DocumentCache : public XERCES_CPP_NAMESPACE_QUALIFIER XMemory
00053 {
00054 public:
00056   static const XMLCh g_szUntyped[];
00057 
00058   enum ValidationMode {
00059     VALIDATION_STRICT = 0,
00060     VALIDATION_LAX    = 1,
00061     VALIDATION_SKIP   = 2
00062   };
00063 
00065   virtual ~DocumentCache() {}
00066 
00068   virtual Node::Ptr loadDocument(const XMLCh* uri, DynamicContext *context, const QueryPathNode *projection = 0) = 0;
00070   virtual Node::Ptr parseDocument(XERCES_CPP_NAMESPACE_QUALIFIER InputSource &srcToUse, DynamicContext *context, const QueryPathNode *projection = 0) = 0;
00072   virtual void parseDocument(XERCES_CPP_NAMESPACE_QUALIFIER InputSource &srcToUse, EventHandler *handler, DynamicContext *context) = 0;
00073 
00079   virtual void setXMLEntityResolver(XERCES_CPP_NAMESPACE_QUALIFIER XMLEntityResolver* const handler) = 0;
00080   virtual XERCES_CPP_NAMESPACE_QUALIFIER XMLEntityResolver* getXMLEntityResolver() const = 0;
00081 
00082   virtual bool getDoPSVI() const = 0;
00083   virtual void setDoPSVI(bool value) = 0;
00084 
00085   /*
00086    * returns true if the type represented by uri:typename is an instance of uriToCheck:typeNameToCheck 
00087    *
00088    * ie: to check 
00089    * xs:integer instance of xs:decimal, 
00090    * call
00091    * isTypeOrDerivedFromType("xs", "integer", "xs", "decimal") 
00092    * (except of course, call with URIs, not prefixes!)
00093    */ 
00094   virtual bool isTypeOrDerivedFromType(const XMLCh* const uri, const XMLCh* const typeName, const XMLCh* const uriToCheck, const XMLCh* const typeNameToCheck) const = 0; 
00095   virtual bool isTypeDefined(const XMLCh* const uri, const XMLCh* const typeName) const = 0; 
00096 
00097   virtual void addSchemaLocation(const XMLCh* uri, VectorOfStrings* locations, StaticContext *context, const LocationInfo *location) = 0;
00098 
00100   virtual unsigned int getSchemaUriId(const XMLCh* uri) const = 0;
00101   virtual const XMLCh* getSchemaUri(unsigned int id) const = 0;
00102 
00103   virtual XERCES_CPP_NAMESPACE_QUALIFIER GrammarResolver *getGrammarResolver() const = 0;
00104 
00105   virtual XERCES_CPP_NAMESPACE_QUALIFIER DatatypeValidator* getDatatypeValidator(const XMLCh* uri, const XMLCh* typeName) const = 0;
00106 
00107   virtual XERCES_CPP_NAMESPACE_QUALIFIER ComplexTypeInfo*  getComplexTypeInfo(const XMLCh* uri, const XMLCh* typeName) const = 0;
00108 
00109   virtual XERCES_CPP_NAMESPACE_QUALIFIER SchemaElementDecl* getElementDecl(const XMLCh* elementUri, const XMLCh* elementName) const = 0;
00110 
00111   virtual XERCES_CPP_NAMESPACE_QUALIFIER SchemaAttDef* getAttributeDecl(const XMLCh* attributeUri, const XMLCh* attributeName) const = 0;
00112 
00113   virtual DocumentCache *createDerivedCache(XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *memMgr) const = 0;
00114 };
00115 
00116 #endif
00117 
00118 
00119 
00120 
00121 
00122 
00123